Topic: Infinity scroll plugin request
Hi, any chance to implement this into Monstra? http://www.infinite-scroll.com/ Instead of pages when i use Blog::Posts(3);
You are not logged in. Please login or register.
Hi, any chance to implement this into Monstra? http://www.infinite-scroll.com/ Instead of pages when i use Blog::Posts(3);
There is a little known feature in the .load() method that lets you specify the CSS selector of the html you want to include. jQuery will load in any local URL, then parse the html and grab only the elements you’ve defined with your selector. This allows for some pretty fun shit: client-side transclusions (a la purple include) ; and some really kickass shit when you combo it with a local php proxy.
This is really the meat of the code:
// load all post divs from page 2 into an off-DOM div $(' ').load('/blog/ #content div.post',function(){ $(this).appendTo('#content'); // once they're loaded, append them to our content area });
Or
// load all post divs from page 2 into an off-DOM div $(' ').load('Blog::Posts(3) #content div.post',function(){ $(this).appendTo('#content'); // once they're loaded, append them to our content area });
So it basically leverages that load() method at its core. It’s basically scraping your existing page structure, which means you don’t need to code any custom backend stuff to enable this functionality!
Ahh I understand now :-D thanks I will try it I have newer worked with javascript and php before :-D So it is a bit new for me.