jquery - Issue with high resolution images in chrome(windows) loading from javascript -
i having problem site. problem loading several images progressively - starting small resolution image fast loading ajaxing bigger image in (normally original size user uploads).
the code below works perfectly. when done on chrome on windows. if bigger image high res (lets 4400 x 4000). screen go white , image disappear. white bursts out of container (which has overflow:hidden) on , covers screen. elements higher z-index on image displays.
if inspect element white. shows element, , image loaded - url fine , if click image open in tab loads fine.
does have idea why happening?
if(href){ var img = document.createelement('img'); img.classname = 'openlbfullview hidden'; img.onload = function(){ loadbiggerimg(this); }; $(img).data('url',$currentimg.data('url')); img.src = href; img.id = 'my-image'; } var loadbiggerimg = function(img){ var originalimg = $('#my-image'); //append img document originalimg.before(img); // append original styles , classes new image $(img).attr('style',originalimg.attr('style')); $(img).attr('class',originalimg.attr('class')); // fix windows ie adding attributes $(img).removeattr('width').removeattr('height'); //fade in new image on top , remove old 1 $(img).fadein(200,function(){ originalimg.remove(); }); }
one of possible solutions - large images dont render in chrome
this not neccesarily fix issue though - i'd try using lowres jpegs scaled highres , preload big 1 - once loaded fade lowres 1 , show big 1 (in way fake progressive jpeg) - hope helps man.
Comments
Post a Comment