Question

Ok, so I'm using the wordpress infinite scroll plugin for a project:

http://www.infinite-scroll.com/

Everything works fine, but I would like to have a div loaded before each page with the page number and an anchor link to the top of the site. I tried a bunch of things on the php side, but this plugin seems to grab individual posts, so any content that I add gets posted to every single post, and not the top of the page. So I went to the javascript side and am looking for the point where the content is loaded so I can prepend a div to it.

I'm pretty sure this is the line:

box.load(path.join( props.currPage ) + ' ' + opts.itemSelector,null,loadCallback);

Is there any way to prepend some html to the .load() method?

Any help on this would be greatly appreciated.

Was it helpful?

Solution

You're looking for the callback method.

 $('#some_id').infinitescroll({
    'navSelector': '.paginationControl'
}, function(elems){
    // elems are the new items (straight HTML)
    // you could prepend here
    $(elems).do_your_manipulation();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top