javascript - get $.height() of an Element with Images in it when Image maybe not loaded yet -
i insert html code after ajax call , in ajax-callback need height of added div. problem is, in html ajax call elements images , other elements have laoded first.
i did simple example of problem in jsfiddle: http://jsfiddle.net/qbwd663s/3/ can see when add code console says 36, if click div says 242 (cause image loaded). works if image allready in cache, test reload page cleared cache.
what need $(document).ready()
elements got called ajax. have idea how that?
$("div *").one("load", function() { alert($("div").height()); });
fiddle: http://jsfiddle.net/aravi_vel/qbwd663s/6/
use load function suggested harry
this function handle other kind of elements have listed (iframe etc.)
Comments
Post a Comment