0

I'm using https://github.com/emn178/jquery-lazyload-any on a page, like this:

<div class="lazyload">
  <!--<div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>
  <div class="item-container"><img src="img.jpg" /></div>-->
</div>

I found a jQuery script that I modified to automatically add the .lazyload class container around every 4 .item-container divs to break them up.

The problem is that for the lazy load plugin to work, the HTML inside the .lazyload container has to be commented out. Therefore, the jQuery doesn't add the .lazyload container. Is there any way to have jQuery modify commented out HTML?

Here's a fiddle.

Community
  • 1
  • 1
bunnycode
  • 275
  • 2
  • 14

0 Answers0