3

i am using http://davidwalsh.name/lazyload-plugin when i run it giving a error in console as "Uncaught ReferenceError: Class is not defined". i added code as below

<script src="lazyload/Source/LazyLoad.js"></script>

then downside

    <script>
/* do it! */
window.addEvent("domready",function() {
    var lazyloader = new LazyLoad();
});
</script>

and in body for images i am using as below.

<img alt=\"\" src=\"lazyload/Assets/blank.gif\" data-src=\"{$v['image_path']}\" style=width:auto;height:200px;max-height:200px>

where $v['image_path'] is dynamic. What is the problem causing that error please help me.

shridhar
  • 73
  • 7

1 Answers1

1

you are missing mootools library . add mootools library above LazyLoad.js

Check DEMO

 <script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools.js"></script>
 <script src="lazyload/Source/LazyLoad.js"></script>


 <script>
   /* do it! */
    window.addEvent("domready",function() {
      var lazyloader = new LazyLoad();
    });
</script>

HTML . in put same image path for src and data-src .

<img alt=\"\" src=\"{$v['image_path']}\" data-src=\"{$v['image_path']}\" style=width:auto;height:200px;max-height:200px>
Nishit Maheta
  • 5,916
  • 3
  • 14
  • 31