开发者

Jquery listener on an element when it display:block/none; property changes

Is this possible? I want an event开发者_如何学JAVA to fire when this happens.


Hmm, why do you need this? Instead, I would suggest thinking about what causes the element to be shown/hidden and react to that. It's always better to decouple your logic from view.

But if you still really want to do this, the only way I can think of right now is to have an interval that keeps polling for the element's visibility.


you could use livequery to do this.

$('div.myClass:hidden').livequery(function(){
//do something when hidden
});
$('div.myClass:visible').livequery(function(){
//do something when visible
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜