2

for people that have used Joomla for a while you are probably familiar with RokSprocket - a content module from RocketTheme, very useful.

It has a 'Load More' button, that can load the next bit of articles. I have been struggling, to remove this button, and to make the articles to load automatically as the users scrolls through the page.

Does someone have experience doing this?

1 Answer 1

3

I've never used RokSprocket before but I hope this answer will help you.

Lets say you have the following HTML markup for your button:

<div class="loadmore">Load more</div>

Now rather than actually hiding the element, you make it transparent instead using CSS:

.loadmore {
    opacity: 0;
}

And as for the auto load, you can trigger a click event once the hidden button is visible in the browser viewport:

jQuery(document).ready(function($){

    var loadmore = $('.loadmore');

    $(document).on('scroll', function(){
        if (loadmore.visible(true)){
            loadmore.trigger('click');
        }
    });

});
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.