jQuery event to trigger action when a div is made visible

Posted by frankadelic on Stack Overflow See other posts from Stack Overflow or by frankadelic
Published on 2009-08-03T23:24:48Z Indexed on 2010/04/10 10:33 UTC
Read the original article Hit count: 362

Filed under:
|

I'm using jQuery in my site and I would like to trigger certain actions when a certain div is made visible.

Is it possible to attach some sort of "isvisible" event handler to arbitrary divs and have certain code run when they the div is made visible?

I would like something like the following pseudocode:

$(function() {
  $('#contentDiv').isvisible(function() {
    alert("do something");
  });
});

The alert("do something") code should not fire until the contentDiv is actually made visible.

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript