Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Infinite Scrolling using infinitescroll jquery plugin


Reply

4 Posts   1869 Views

Avatar
tlarevo

29 March 2012 at 10:45pm Community Member, 2 Posts

I want to implement infinite scrolling in the BlogHolder, I've tried this using the Infinite-Scrolling jQuery plugin found at http://www.infinite-scroll.com/ even though I follow the common instructions to setup the plugin, its not working at all. Can someone give an idea how to get it to work or give me a similar solution for Silverstripe that works(I have attached the Jquery plugin). Thank you

Attached Files
Avatar
AndrewLowther

14 May 2012 at 10:48pm Community Member, 3 Posts

I've forked infinite scroll myself in order to fix this, as we're having the same issue.

I've added an option called currPageIncrement in state, so that you can pass whatever number you need to make it work, the code is here:

https://github.com/AndrewLowther/infinite-scroll

Avatar
EDi

27 May 2013 at 11:11pm Community Member, 5 Posts

Hi! Can someone help me with this? I'm getting a "Sorry, we couldn't parse your Next (Previous Posts…, and kindly ask for help at infinite-scroll.com." error and don't know how to get it work.

I think a link to the SS site using this plugin will be enough, but if you like to examine the code, here it goes.

SS 3.0.5

JS:

// infinite scroll
$('#content.PortfolioHolder').infinitescroll({
   navSelector : "#pagination",
   nextSelector : "#pagination a#next",
   itemSelector : "#content article.thumb",
   debug : true,
   dataType : 'html',
}, function(newElements){
   window.console && console.log('context: ',this);
   window.console && console.log('returned: ', newElements);
});

HTML:

<section id="content" class="PortfolioHolder">
<article class="thumb">Blah...</article>
<article class="thumb">Blah...</article>
<article class="thumb">Blah...</article>

<section id="pagination">
<a id="next" href="http://localhost:8888/hopa/portfolio/?start=4">Next</a>
</section>
</section>

Avatar
EDi

29 May 2013 at 12:09am (Last edited: 29 May 2013 12:11am), Community Member, 5 Posts

Nevermind...

I have found another solution.
[url=https://github.com/webcreate/Infinite-Ajax-Scroll]Infinite Ajax Scroll[/url]

JS:

   // infinite ajax scroll
   jQuery.ias({
      container : '#content.PortfolioHolder',
      item: 'article.thumb',
      pagination: '#pagination',
      next: '#pagination a#next',
      loader: '<img src="' + $('base').attr('href') + 'themes/hopa/img/loader.gif"/>',
      triggerPageThreshold: 2,
      onRenderComplete: function(){ $(window).trigger('resize'); },
      history : false,
   });