Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page don't scroll on top while going next page.. #152

Open
Farshan opened this issue Jun 9, 2020 · 1 comment
Open

page don't scroll on top while going next page.. #152

Farshan opened this issue Jun 9, 2020 · 1 comment

Comments

@Farshan
Copy link

Farshan commented Jun 9, 2020

I have some products in my page, when I am clicking on next page, webpage is not scrolling on top.
It just goes half the webpage.
please help me out.
thank you.

@Sandy-Garrido
Copy link

Sandy-Garrido commented Jun 14, 2020

Hi - This issue isn't related to the script, however, to enable this on click. You'll need to declare a function in the onPageClick option. See Available Options for onPageClick

For example

$('#selector').pagination({
    items: numOfItems,
    itemsOnPage: postsPerPage,
    currentPage: currentPageNum,
    displayedPages: 4,
    onPageClick: function () { // <------  you can add a function to onPageClick
        window.scrollTo({top: 0, behavior: "smooth"}); // this is the line which will execute on page click.
    },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants