Home » Javascript » masonry imagesloaded function creating javascript memory issue

masonry imagesloaded function creating javascript memory issue

Posted by: admin August 19, 2018 Leave a comment

Questions:

I am using masonry in my web page and in that I am using imagesloaded function.

At first I am loading 28 images only, so for that imagesloaded function runs 28 times and then I have a button loadmore which loads 28 more images. On this imagesloaded function runs 56 times to adjust all the images according to masonry and if I continue to loadmore each time function runs as many times as many images on page, which after 7-8 loadmore presses create JavaScript memory issues and hangs the browser.

Javascript memory as one can check in task manager of chrome generally increases and decrease itself after running the process but here it’s not decreasing.

Please help me out how I clear JavaScript memory.

Answers: