0
votes

I put an infinite scroll plugin ajax, but works automatically when scrolling down. I want to change the auto-scroll with no automatic or with the "more".

The following is the code I used with masonry

jQuery.ias({
    container : '#main',
    item: '.post-outer',
    pagination: '#blog-pager',
    next: '#blog-pager-older-link a',
    loader: 'http://2.bp.blogspot.com/-XIF8-dkyzkQ/UXC35axRdfI/AAAAAAAAGg0/Q7xRk-yFLP4/s1600/loader.gif',
    onLoadItems: function(items) {
        var $newElems = jQuery(items).show().css({ opacity: 0 });
        $newElems.imagesLoaded(function(){
             $newElems.animate({ opacity: 1 });
             jQuery('#main').masonry( 'appended', $newElems, true );
        });
        return true
    }    

});

link examples: page-elements.blogspot.com

Plugin infinite: infinite-ajax-scroll

What should I add code to change in order to be non-automatic with the "more"?

I'm sorry if my language is less clear, thanks

the problem I'm done, I added the "trigger: 'Load More'"

thanks for help.

2

2 Answers

0
votes
0
votes

I had the same problem. But I solved It.

First you have to return "this" object from ias plugin.around line 85;

// initialize
        return init();

Then when you initialize ias plugin hold this variable in a global variable.

infiniteScroller = $.ias({
                            container : '.jscroll',
                            item : '.column',
                            pagination : '#content .navigation-js',
                            next : '.next-posts a',
                            loader : '<img src="https://raw.github.com/webcreate/infinite-ajax-scroll/master/dist/images/loader.gif"/>',
                            triggerPageThreshold : 15,
                            history : false
                        });

And then where you are retrieving new data. After data loads to a page do this;

delete infiniteScroller;
                            infiniteScroller = $.ias({
                                container : '.jscroll',
                                item : '.column',
                                pagination : '#content .navigation-js',
                                next : '.next-posts a',
                                loader : '<img src="https://raw.github.com/webcreate/infinite-ajax-scroll/master/dist/images/loader.gif"/>',
                                triggerPageThreshold : 15,
                                history : false
                            });

Hope this will be a help for you.