开发者

JQuery: How to determine if Slide event is up or down?

开发者 https://www.devze.com 2022-12-28 11:27 出处:网络
I have the following code: $(\'a.btn-slide\').toggle(function() { $(\"#DivToSlide\").slideUp(\"fast\");

I have the following code:

$('a.btn-slide').toggle(function() {
    $("#DivToSlide").slideUp("fast");
    // ...
}, function() {
    $("#DivToSlide").slideDown("fast");
    // ...
});

Later in my code, I want to find out if #DivToSlide is in either 开发者_StackOverflow社区the up or down position.

How do I do that?


Since the slideDown function hides the element after it finishes, you can simply check whether the element is visible:

if ($('#DivToSlide').is(':visible'))

You could also check whether $('#DivToSlide').height() is more than some threshold.


if($(this).next('.nxt_div').height()>1){ }
0

精彩评论

暂无评论...
验证码 换一张
取 消