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){ }
精彩评论