[英]Jquery trigger div height change event (animate?)
I need to detect the total height of my div "collectionFilterPage" while the animate event is running. 我需要在动画事件运行时检测div“ collectionFilterPage”的总高度。 Is there any event to bind?
是否有任何要绑定的事件? This is my ja code:
这是我的ja代码:
function showMoreItems() {
$("#collectionFilterPage").animate({
height: "+=720"
}, 1000, function() {
if ($("#collectionFilterPage").outerHeight() >= $(".lista").outerHeight())
unbindScrollEvent();
});
}
Basically I would want to fire the "unbindScrollEvent" when both div "collectionFilterPage" and "lista" have the same height. 基本上,当div“ collectionFilterPage”和“ lista”具有相同的高度时,我想触发“ unbindScrollEvent”。 thanks
谢谢
You might want to switch to this $().aninate
signature and use the step
property which allows you to set a callback function that is called during each step of the animation. 您可能需要切换到
$().aninate
签名,并使用step
属性,该属性允许您设置在动画的每个步骤中调用的回调函数。
function showMoreItems() {
function checkHeight() {
if ($("#collectionFilterPage").outerHeight() >= $(".lista").outerHeight())
unbindScrollEvent();
}
$("#collectionFilterPage").animate({
height: "+=720"
}, {
duration: 1000,
complete: checkHeight,
step: checkHeight
});
}
http://api.jquery.com/animate/ http://api.jquery.com/animate/
$(...).animate( properties, options );
Solved. 解决了。 It has been very easy
这很容易
height: $("#collectionFilterPage").outerHeight() >= $(".lista").outerHeight() ?
高度:$(“#collectionFilterPage”)。outerHeight()> = $(“。lista”)。outerHeight()吗? "+=0" : "+=720"
“ + = 0”:“ + = 720”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.