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

Force scroll back to top #115

Open
GonrasK opened this issue Oct 23, 2019 · 1 comment
Open

Force scroll back to top #115

GonrasK opened this issue Oct 23, 2019 · 1 comment

Comments

@GonrasK
Copy link

GonrasK commented Oct 23, 2019

How do i force scroll back to top after moving from page to page (clicking 'next' or on the page's number)? In case my pagination is below the search results.

<paginate v-if="page_count > 1" v-model="page" :page-range="8" :pageCount="page_count" :containerClass="'pagination'" :clickHandler="clickCallback" :prev-text="'Prev'" :next-text="'Next'" > </paginate>

@flyingL123
Copy link

I'm doing that in the click handler. I place a ref at the top of my content, and then scroll it into view:

<div ref="top"></div>
<div>
    <!-- my paginating content -->
</div>
<paginate :click-handler="onPaginate"/>

Then in the onPaginate method:

function onPaginate () {
    this.$refs.top.scrollIntoView();
}

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