slideToggle how to check whether it's opened or closed
I'm us开发者_运维技巧ing slideToggle for a div. How i can check whether the slide is opened or closed?
you can use
$('#divId').is(':visible');
You can try below:
$('#btn').click(function() {
$('#content').slideToggle('slow', function () {
if ($('#contentDetail2').is(':hidden')) {
// some code when content is hidden
}
else {
// some code when content is shown
}
});
});
精彩评论