當您將鼠標懸停在Google圖片所使用的圖片縮略圖上時,我正在嘗試創建圖片放大效果。但是,我遇到了一個問題,放大後的圖像會根據放大圖像的位置不斷將其他圖像推到另一個位置。放大鼠標懸停圖像,而不使用Jquery推動其他圖像?
這是我到目前爲止有:
<style>
img{float:left;}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#I1").mouseover(function(){
$("#I1").animate({height:300,width:300},"fast");
});
$("#I1").mouseout(function(){
$("#I1").animate({height:96,width:128},"fast");
});
});
</script>
<img id="I1" src="http://www.dpstudiolab.com/weblog/wp-content/uploads/2007/11/display-pop-up-2.thumbnail.jpg" >
<img id="I2" src="http://www.dpstudiolab.com/weblog/wp-content/uploads/2007/11/display-pop-up-2.thumbnail.jpg" >
@ user701510更新答案用簡單的解決方案 – Swader
這種簡單的解決方案徘徊的元素第二個時間後卡住。 –
因此,單詞「簡單」,我沒有真正注意優化內存消耗,防止創建多個監聽器等。我只是將它發佈給OP,以便對如何完成它有一些基本的想法。但好的,我會修理小提琴。 – Swader