<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><link href="css.css" rel="stylesheet"><script src="../../jquery/jquery-2.1.4.min.js"></script><script src="js.js"></script></head><body><div class="div"><img src="img/2.jpg"><img src="img/4.jpg"><img src="img/3.jpg"></div></body></html><!--下面是jQuery-->$(function(){ $(".div img").mousemove(function(){ $(this).animate({width:"300"},1000).siblings().animate({width:"225"},1000) }) .mouseout(function(){ $(this).css({width:"250"}) }) })
1 回答
已采纳
stone310
TA贡献361条经验 获得超191个赞
$(function(){
$(".div img").mouseover(function(){
$(this).stop().animate({width:'300'
},1000).siblings().stop().animate({width:'225'
},1000)
}).mouseout(function(){
$(this).stop().css({width:'250'
})
})
})不知道你要的是不是这种效果,主要添加stop(),为了在触发执行时先将上一次动画停止,之前触发的未完成动画会一直执行
- 1 回答
- 0 关注
- 2209 浏览
添加回答
举报
0/150
提交
取消
