开发者

jquery event handler: div becomes visible/hidden

I have a div and I'd like to have an event handler listen to when it becomes visi开发者_如何学运维ble and hidden. How do you do that?

Thanks.


You can use the callback parameter in the show() and hide() methods like this:

$('#myDiv').show(0, onDivShow);
$('#myDiv').hide(0, onDivHide);

function onDivShow() { //your code here }
function onDivHide() { //your code here }

See a working example here: http://jsfiddle.net/N7UNU/


You can create a trigger. You would, of course, have to fire the trigger, but that is one way to do it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜