2 Replies Latest reply on Apr 26, 2010 11:07 AM by Stefan Waldner

    Using jquery lazyload plugin

    Stefan Waldner Newbie

      Hi,

       

      we are using JBoss portal 2.7.2 and RichFaces 3.3.2. One of our portlets contains a lot of images (>1000), that's why we are trying to add the lazyload functionality for the images from the jQuery lazyload plugin: http://www.appelsiini.net/projects/lazyload

       

      The plugin works perfect in a non-portlet and non- RichFaces environment, but we are not able to call the lazyload function inside JBoss Portal using RichFaces. We tried to load the scripts using a simple html sript tag and the a4j:loadScript, both seem to load the script correctely:

       

      <a4j:loadScript src="/js/jquery-lazyload-1.5.0.js" />

       

      <script type="text/javascript" src="js/jquery-lazyload-1.5.0.js"/>    

       

      When trying to call the lazyload method, Firebug always reports: lazyload is not a function. We tried the following two methods:

       

      <script language="JavaScript">
                  jQuery(document).ready(function(){
                      jQuery('img').lazyload();
                    });
      </script>    

       

      <rich:jQuery selector="img" timing="onload" query="lazyload()"/>

       

      Does anybody know how to get this works?

       

      Thanks and best regards.