Skip to content

jscroll does not load the new content all the time #166

Description

@munagurung

Hello,

I am using jscroll on a search page in a laravel app and it doesn't work all the time. Sometimes jscroll doesn't load the second page, I can see from the telescope that the jscroll has requested for the second page and that the app has returned a valid response. However, jscroll doesn't add the new content in the view and keeps on showing the loading html. I have attached an image of the developer tool's console log when the result does not load in the view.

jscroll

My jscroll js implementation looks like this.

window.addEventListener('load', initSearch);

function initSearch() {
    searchJScroll();
}

function searchJScroll() {
    const html = '<div class="text-muted align-items-center text-center"><i class="fas fa-2x fa-spinner fa-spin"></i> Loading...</div>';
    const options = {
        debug: true,
        autoTrigger: true,
        loadingHtml: html,
        padding: 0,
        nextSelector: '.pagination li.active + li a',
        contentSelector: '.jScroll',
        pagingSelector: '.pagination',
        callback: function () {
            $('ul.pagination').remove();
        }
    };

    $('.jScroll').jscroll(options);
}

Any insight would be greatly appreciated. Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions