Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Inifinite scroll and lazy load

    Zencart 1.5.6

    I am using a module called infinite scroll.
    https://zucando.com/zen-cart-modules...nfinite-scroll

    All seems to work well. The only issue I have is that I use lazy loader for images. Everything loads fine for the first page. For some reason when I scroll to the bottom and it reloads the infinite scroll the lazy load images do not appear.

    How do I make the lazy load refire while using Ajax scrolling pagination?

    Below is the Jquery_Scrolling_pagination.js file. I believe this is what i have to edit. If someone could assist me or lead me in the right direction on solving this issue i would greatly appreciate it.



    Code:
     jQuery(document).ready(function(){
      var nextlink = jQuery('#productsListingListingBottomLinks a.nextpage');
      
      //get the offset top of the element
      var nextQueryPosition = '';
      if(nextlink.offset() !== undefined) {
    	var nextQueryPosition = parseInt(nextlink.offset().top); 
      }
      
      var products = '';
      var positionToQuery = parseInt(jQuery('#ajax_scrolling_pagination_query_position').text());
      
      function queryProducts(nextlink, products) {
        
        if (typeof nextlink.attr('href') !== 'undefined') {
        
          var loading = true;
          jQuery(window).scroll(function() { //when window is scrolled
            //console.log('start: '+ jQuery('.wp-index-pagination a').attr('href'));
            //console.log(jQuery(window).scrollTop());
            if((jQuery(window).scrollTop() + $(window).height() >= $(document).height() -600) && loading == true) {
              if (window.console) console.log('Processing URL: '+nextlink.attr('href')); //position of the ele w.r.t window
              loading = false;
              jQuery.ajax({
                url: nextlink.attr('href'),
                beforeSend: function(){
                  jQuery(jQuery('#ajax_scrolling_pagination_append_loading_image').text()).append('<p class="listing-image-loading" align="center"><img src="./images/ajax-circle-loader.gif" /></div>');
                },
                success: function(data) {
                
                  products = jQuery(data).find(jQuery('#ajax_scrolling_pagination_append_loaded_products').text()).html();
                  jQuery(jQuery('#ajax_scrolling_pagination_append_loaded_products').text()).append(products);
                  
                  // Reset variables
                  var products = '';
    
                  nextlink = jQuery(data).find('#productsListingListingBottomLinks a.nextpage');
                  positionToQuery += parseInt(jQuery('#ajax_scrolling_pagination_query_position').text());
                  queryProducts(nextlink, products);
                  
                },
                complete: function(){
                  jQuery('.listing-image-loading').remove();
                }
              });
              return false;
            }
    
          });
          return false;
        }
      }
      queryProducts(nextlink, products);
    });

  2. #2
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Inifinite scroll and lazy load

    anyone have any ideas... or lead me in the right direction?

  3. #3
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Inifinite scroll and lazy load

    Okay I figured it out. I used this script in the lazy loader function start.js. This seem to solve my issue

    Code:
    jQuery(function() {
    
    $("img.listingProductImage").lazyload({ 
        effect: "fadeIn" 
    }).removeClass("listingProductImage");
    $(document).ajaxStop(function(){
        $("img.listingProductImage").lazyload({ 
            effect: "fadeIn" 
        }).removeClass("lazy");
    });
    });

 

 

Similar Threads

  1. NO more next page .. auto load on scroll
    By jennydutch in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 21 Oct 2014, 10:52 PM
  2. Jquery Lazy load plugin
    By Dan123 in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 29 Jun 2014, 06:33 PM
  3. v151 Large page width with scroll and css
    By sports guy in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 21 Nov 2012, 02:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR