JQuery "on appear" event -


my application adds elements dom after $(document).ready has been called. i'm using jquery 1.9.0

the following example works.

$(document).on("click", "#box-descr", function(evt) {     console.log("i showed up"); }); 

however, want execute function when element appears on screen. couldn't see event purpose here http://api.jquery.com/category/events/

basically it's single page application, document ready called once elements come in , out of screen user interacts ui.

may want .ready() function :

$("#box-descr").ready(function(){    console.log("i showed up");    }); 

or if fading in :

$("#box-descr").fadein(1000, function(){    console.log("i showed up");    }); 

update: @jeff tian's comment-

you need delegate event either closest static parent or document this:

$(document).on("ready", "#box-descr", function(){    console.log("i showed up");    }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -