问题描述
我做这个
$("#developments ul").animate({
marginLeft: -1*((ul_width+li_padding)*(how_many_more+1)+how_many_more*ul_padding)},30000,'linear'
);
当ul的左边距= -1 *((ul_width + li_padding)*(how_many_more)+ how_many_more * ul_padding)时,我想做些什么我可以使用.change()处理函数吗?如果是,我该如何使用该处理程序?我尝试
I want to do something when margin-left of ul=-1*((ul_width+li_padding)*(how_many_more)+how_many_more*ul_padding)Can i use .change() handler? if yes how can i use this handler?I try this
$("#developments ul").css("margin-left").change(function() {
alert("handler");
});
但是它不起作用..这是合理的,因为$(#developments ul").css("margin-left")返回一个数字.作为数字的数字是静态的,永远不能改变!有帮助吗?
But it doesn't work..This is reasonable because $("#developments ul").css("margin-left") returns a number.A number as number is static and can't be change never!!Any help?
推荐答案
您可以绑定.animate选项的step属性
You can tie into the step property of the .animate options
$("#developments ul").animate({
marginLeft: -1 * ((ul_width + li_padding) * (how_many_more + 1) + how_many_more * ul_padding)
}, {
duration: 30000,
easing: "linear",
step: function(now, fx) {
if (now === -1 * ((ul_width + li_padding) * (how_many_more) + how_many_more * ul_padding)) {
alert("handler");
}
}
});
类似的事情应该起作用.
Something like that should work.
这篇关于.animate动画中间的jquery事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!