germanysbestkeptsecret / Wookmark-jQuery

A jQuery plugin to create a dynamic, multi-column layout.
MIT License
2.64k stars 759 forks source link

Images src 'undefined' after resizing in iPhone UIWebView #96

Closed bitsdisasters closed 10 years ago

bitsdisasters commented 11 years ago

When plugin makes its jobs and resizes the elements with images, all the src for images are lost and theirs values goes to 'undefined'. When page loads it shows one column. After that, when it is reallocating elements, the images disappear and src values change to 'undefined'. I'm sending some screenshots attached. This is not happening in other device or browse than webkit in my iOS app.

These are the settings:

// Prepare layout options. var options = { itemWidth: 140, // Optional min width of a grid item autoResize: true, // This will auto-update the layout when the browser window is resized. container: $('.discover-grid-container'), // Optional, used for some extra CSS styling offset: 20, // Optional, the distance between grid items flexibleWidth: 200 // Optional, the maximum width of a grid item }; Thank you for your help

img_0353 img_0354

Sebobo commented 11 years ago

Hi,

are you using parts of the example-api, example-endless-scroll or something like that? It would help if you provide the complete JS-code.

Regards

thunguyen2015 commented 11 years ago

I got the same issue when tried with endless-scroll. I figured out that if there is one of wrong images url return from ajax (image not found) ,all images wil have src="undefined". below is code i modified from example-endless-scroll to to reproduce the issue (../sample-images/image_11.jpg is not found) function onScroll(event) { .... //../sample-images/image_11.jpg is not found. so below line of code will make make all image have src='undefined' var item ='<li><img src="../sample-images/image_11.jpg" width="200" height="267"><p>30</p></li>' $('#tiles').append(item); applyLayout(); };

Sebobo commented 11 years ago

I've just comitted a new imagesLoaded plugin. Could you try if it works better?