Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 100 products in my home page....
at first time it will take more time to load because the home page have 100 product..
i want like this..
fist i want to load 20 products in my home page..
while scrolling down i want to load remaining products...
please help me regarding this..
for example you can see this site..
http://www.snapdeal.com/products/men-apparel-innerwear/?q=Type%3AThermals&[^]
Posted

1 solution

Add jquery to call The other product which is listed in different page, Each page contain only 20 Products. And Call that page in order by using This code.
PHP
$(document).ready(function() {
  var pageNum = 1;
  $('#more-product').click(function() {
    var $link = $(this);
    var url = $link.attr('href');
    if (url) {
      $.get(url, function(data) {
        $('#gallery').append(data);
      });
      pageNum++;
      if (pageNum < 20) {
        $link.attr('href', 'pages/' + pageNum + '.html');
      }
      else {
        $link.remove();
      }
    }
    return false;
  });
});



(function($){
$('div.product').live('mouseenter mouseleave', function(event) {
var $details = $(this).find('.details');
if (event.type == 'mouseenter') {
$details.fadeTo('fast', 0.7);
} else {
$details.fadeOut('fast');
}
});

$(document).bind('nextPage', function() {
var url = $('#more-product').attr('href');
if (url) {
$.get(url, function(data) {
$('#gallery').append(data);
});
}
});

var pageNum = 1;
$(document).bind('nextPage', function() {
pageNum++;
if (pageNum < 20) {
$('#more-product').attr('href', 'pages/' + pageNum + '.html');
}
else {
$('#more-product').remove();
}
});

$(document).ready(function() {
$('#more-product').click(function() {
$(this).trigger('nextPage');
return false;
});
});
})(jQuery);
 
Share this answer
 
v3
Comments
Kumar Kovuru 5-Dec-13 4:32am    
Not working... :( please any one...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900