多くの人が以前に尋ねたことをやろうとしていますが、すべてを試した後でも、私が望む結果を得ることができません.
600px x 1600px の画像があり、縦に 600px x 400px の画像が 4 つあります。一度に 600px x 400px の画像を表示したい。理想的には、ページのどこかにある要素にカーソルを合わせ、画像を上に移動して、600px x 400px の画像の他の部分を表示できるようにします。実際には、4 つの要素にカーソルを合わせると、4 つの画像が表示されます。
さまざまな css3 および jquery ソリューションを試しましたが、どれも機能しませんでした。これについて何か助けていただければ幸いです。
HTML
<div class="mainimage">
<div class="buttonsection">
<div class="button1">Button 1</div>
<div class="button2">Button 2</div>
<div class="button3">Button 3</div>
<div class="button4">Button 4</div>
</div><!--end of buttonsection-->
<div class="rollingimage">
<img src="IMG/four-pics.png">
</div><!--end of rollingimage-->
</div><!--end of mainimage-->
</div><!--end of main content-->
CSS
.mainimage {
position: relative;
top: 0px;
left: 0px;
width: 900px;
height: 400px;
border: 2px solid #E78F25;
margin: 0 10px 20px 0;
}
.buttonsection {
width: 290px;
height: 400px;
position: relative;
float: left;
}
.button1,
.button2,
.button3,
.button4 {
display: inline;
height: 98px;
width: 290px;
border: 1px solid #E78F24;
text-align: center;
float: left;
}
.rollingimage {
width: 598px;
height: 400px;
position: relative;
overflow: hidden;
top: 0px;
left: 0px;
float: right;
}
jquery
$(document).ready(function(){
$(".button1").hover(function(){
$('.rollingimage').stop().animate({'top': '-200px'}, 1500);
});
});
これがjsfiddleです: http://jsfiddle.net/dirtyd77/jCvYm/1/
ありがとう
ゲイリー