javascript - window.load and document.ready still waiting for DOM -
in case, need check height of images (100% width).
$(window).load(function() { var heightimage = $('ul.images li[style*="display: list-item"] img').height(); $(window).resize(function() { var heightimage = $('ul.images li[style*="display: list-item"] img').height(); $('ul.images').css("height", heightimage + "px"); }).resize(); });
with method of .load
function, waits contents ready loaded after check height of images.
if use
$(document).ready(function() {
it doesn't check images height. weird when inspect element, loads .ready
function , gives me height of image. if, .ready
function, in case, works when there activity in web, such when inspect element.
how solve this.
can help, please? in advance.
hope helps
$('ul.images li[style*="display: list-item"] img').load(function() { var heightimage = $(this).height(); $(window).resize(function() { var heightimage = $('ul.images li[style*="display: list-item"] img').height(); $('ul.images').css("height", heightimage + "px"); }).resize(); });
Comments
Post a Comment