Problem:
When clicking the next link at the bottom of the page I expected to go to the top of the next page.
Solution:
There isn't such a built-in feature within Views plugin, but you can try with some custom JS codes, for example:
1) Edit your view, find the "next" and "Previous" link shortcode, add attribute class="scroll-to-top" in it, for example:
[wpv-pager-prev-page force="true" class="scroll-to-top"][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page] [wpv-pager-next-page force="true" class="scroll-to-top"][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]
2) in section "Filter Editor", click "JS editor", add below JS codes:
function scroll_to_top(){ jQuery("a.scroll-to-top").click(function(event) { jQuery("html, body").animate({ scrollTop: 0 }, "slow"); // jump to the page top event.preventDefault() }); } jQuery( document ).on('js_event_wpv_pagination_completed', function( event, data ) { // when ajax pagination is completed scroll_to_top(); }); scroll_to_top();
And test again.
Relevant Documentation:
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
This topic contains 2 replies, has 2 voices.
Last updated by 7 years, 2 months ago.
Assisted by: Luo Yang.