Max*_*rai -1 javascript jquery
我有这样的代码:
$('div.new_menu').hover(function(){
$(this).stop(false, true).animate({width: $(this).width() + 25}, 450);
},function(){
$(this).stop(false, true).animate({width: $(this).width() - 25}, 450);
});
Run Code Online (Sandbox Code Playgroud)
它在IE以外的所有浏览器中都很完美.你能帮我改写它吗?
尝试将第一个参数设为stop()as true.同时将宽度更改为相对宽度
动画属性也可以是相对的.如果提供带有前导+ =或 - =字符序列的值,则通过从属性的当前值加上或减去给定数字来计算目标值.
$('div.new_menu').hover(function(){
$(this).stop(true, true).animate({width: '+=25'}, 450);
},function(){
$(this).stop(true, true).animate({width: '-=25'}, 450);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
85 次 |
| 最近记录: |