开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜