About Lazyload

hectorhe / 2017-08-08 08:09:25   

Hello:

I read a thread about the script "lazyload" but I didn't understand hot to properly enable it… There is "jquery.lazyload.js" file inside js folder so I added the next line between the of "index.php" from my theme.

  1. <script type='text/javascript'> 
  2.     $(function() {          
  3.         $("img").lazyload({
  4.             effect      : "fadeIn",
  5.         });
  6.     });
  7. </script>

But seems like it doing nothing… What I can do to enable this useful script?

Thanks in advance!
h

hectorhe / 2017-08-25 23:09:53   

Hello:

Apparently, lazyload script only works without "src" attribute plus "class" attribute, so it requires properly coding skills…

Although, I found a script it with a similar function (I think):

  1. <script type="text/javascript">
  2.   $(document).ready(function () {
  3.     $("img").hide();
  4.     $("img").bind("load", function () { $(this).fadeIn("fast"); });
  5.   });
  6. </script>

Thanks! h

This thread has been closed, thank you.