Question

I am having trouble with the width of a div not resizing when it's dynamic content is loaded.

enter image description here

As you can see in this screenshot, that the first few divs do not get the width of it's dynamically loaded child images. But as you can see, the later divs that are loaded after the server have time to render the child images DO get the child width.

The site is based on Masonry. I have been trying to solve this problem with a masonry method called:

$('.masonry-container').masonry('reloadItems')

but it is not working.

I have also tried:

window.location.reload()

but all that does is reload the page.

Any thoughts?

Was it helpful?

Solution

If your layout has images, you probably need to use imagesLoaded. http://masonry.desandro.com/faq.html

OTHER TIPS

Try looking in some Developer tools, like Chrome's and inspect the "half-loaded" image, you should usually see why it's not wrapping the content.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top