あなたは、これは常に
$('.tile')
// tile mouse actions
.on('mouseover', function(){
$(this).children('.photo').css({'transform': 'scale('+ $(this).attr('data-scale') +')'});
})
.on('mouseout', function(){
$(this).children('.photo').css({'transform': 'scale(1)'});
})
.on('mousemove', function(e){
$(this).children('.photo').css({'transform-origin': ((e.pageX - $(this).offset().left)/$(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top)/$(this).height()) * 100 +'%'});
})
// tiles set up
.each(function(){
$(this)
// add a photo container
.append('<div class="photo"></div>')
// some text just to show zoom level on current item in this example
.append('<div class="txt"><div class="x">'+ $(this).attr('data-scale') +'x</div>ZOOM ON<br>HOVER</div>')
// set up a background image for each tile based on data-image attribute
.children('.photo').css({'background-image': 'url('+ $(this).attr('data-image') +')'});
})
HTML
<div class="tiles">
<div class="tile" data-scale="1.1" data-image="http://ultraimg.com/images/0yS4A9e.jpg"></div>
<div class="tile" data-scale="1.6" data-image="http://ultraimg.com/images/hzQ2IGW.jpg"></div>
<div class="tile" data-scale="2.4" data-image="http://ultraimg.com/images/bNeWGWB.jpg"></div>
</div>
CSS
JS私のため
https://codepen.io/ccrch/pen/yyaraz
を働き、これを試してみました
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:700); body { background: #fff; color: #000; margin: 0; } .tiles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .tile { position: relative; float: left; width: 33.333%; height: 100%; overflow: hidden; } .photo { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-repeat: no-repeat; background-position: center; background-size: cover; transition: transform .5s ease-out; } .txt { position: absolute; z-index: 2; right: 0; bottom: 10%; left: 0; font-family: 'Roboto Slab', serif; font-size: 9px; line-height: 12px; text-align: center; cursor: default; } .x { font-size: 32px; line-height: 32px; }
ようこそStackOverflow!私たちがあなたを助けるためには、より具体的になる必要があります。ホバーで拡大しようとしている要素は何ですか?それらのコードは何ですか?これまでに行ったすべての関連コードを[**最小限で完全で検証可能な例**](http://stackoverflow.com/help/mcve)に表示するように質問を更新してください。サイト自体にリンクすると役立つ場合があります。詳細については、[**よくある質問をどうやるか**](http://stackoverflow.com/help/how-to-ask)に関するヘルプ記事を参照して、サイトの[**ツアー**](http://stackoverflow.com/tour):) –