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

Prevent pagination back to top #711

Closed
metalgigio opened this issue Jan 22, 2021 · 5 comments
Closed

Prevent pagination back to top #711

metalgigio opened this issue Jan 22, 2021 · 5 comments

Comments

@metalgigio
Copy link

metalgigio commented Jan 22, 2021

Hi,
i just upgraded from 1.5.0 to 2.3.1.
I noticed than now when i click on a pagination's link it fires the # link so it goes to top.
There's a way to prevent it or setting a different anchor? My pagination is on a table near the footer so jumping on top is a little weird for users.
Thanks in advance

@hamburger123456
Copy link

I have got the same problem. Did you solve it?

@hamburger123456
Copy link

I patched the sources with e.preventDefault();
after line events.bind(pagingList.listContainer, 'click', function (e) { ....

@Siltaar
Copy link

Siltaar commented May 7, 2022

Another solution is to define the item property of the pagination configuration with a template that includes the id of the list. This way, when you change the current page, you scroll up to the top of the list only.

new List('my_list', { 
    pagination: {
        item: '<li><a class="page" href="#my_list"></a></li>'
    }
});

@pemberton-rhan
Copy link

If anyone else comes across this issue you can just add a forward slash after the anchor to prevent it from jumping to the top.

new List('my_list', { …
    pagination: {
        item: '<li><a class="page" href="#/"></a></li>'
    }
});

@Stolzenhain
Copy link

Stolzenhain commented Sep 19, 2023

see #727 for a more elegant solution using <button>

Also @metalgigio – could we close this ticket? I know one should probably adapt this with a pull request but since it seems to have worked for you, we could clean up the issue queue like this.

[Edit:] Ok, there's even a pull request fixing this GH-750 – suppose this would render issues like these obsolete

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

5 participants