当您将鼠标悬停在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