1 2015-01-31 14:28:49

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);

Re: Infinity scroll plugin request

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!

wink

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink

wormsunited's Website

Re: Infinity scroll plugin request

Ahh I understand now :-D thanks I will try it smile I have newer worked with javascript and php before :-D So it is a bit new for me.