Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  113] [ 3]  / answers: 1 / hits: 29717  / 6 Years ago, wed, march 21, 2018, 12:00:00

Instead of lazy loading image alone,i need to add lazy load for entire div element in my page.



Can you anyone help me out with some plugins or own js code.


More From » jquery

 Answers
33

You can use this plugin. Its helpful and will do the trick for you.



https://github.com/emn178/jquery-lazyload-any



Just use this script as shown in documentation.



<div id=you-want-lazyload>
<!--
<p>Anything you want to lazyload</p>
-->
</div>


JavaScript



$('#you-want-lazyload').lazyload(options);


Hope it will help.



Edit



HTML
Attribute Style



<div id=you-want-lazyload data-lazyload=&lt;p&gt;Anything you want to lazyload&lt;/p&gt;>
</div>


Script Style



<div id=you-want-lazyload>
<script type=text/lazyload>
<p>Anything you want to lazyload</p>
</script>
</div>

[#54893] Saturday, March 17, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyreese

Total Points: 739
Total Questions: 95
Total Answers: 98

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
;