how to prevent browser from scrolling to the top of the page on post navigation?
-
good evening,
i’m working on a WP that uses Pages as the primary delivery for content.
in summary : whenever a link is clicked to navigate to the next Post, the browser window scrolls back to the very top of the Page. i want the Post content to update, not the entire page to refresh… but i can’t find anyone else with the same problem, so i assume it’s a fundamental mistake i’m making.
my page.php has several references to the Loop, using :
<?php rewind_posts();?> <?php query_posts('showposts=1&category_name='.$slug.'&post_type=post&order=ASC');?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> --CONTENT-- <?php endwhile; else: ?> <p>Sorry, there are no posts to display</p> <?php endif; ?>
the Page is in three sections, each with a reference as posted above.
First to pull the Featured Image from the Page and display it as a background image. Second to generate an index of all Posts with the same Category as the name of the Page. Third to display the first Post of the correct Category, and allow for Post Navigation of all Posts within that category.
the third section is giving me problems.
when i click the
<?php next_post_link( ‘%link’, ‘Next post in category’, TRUE ); ?>
link on the third section, it loads the next Post… but the entire browser window scrolls back to the top. then i have to scroll back down to the bottom to view the newly loaded Post.
how do i prevent this scrolling???
thanks!
- The topic ‘how to prevent browser from scrolling to the top of the page on post navigation?’ is closed to new replies.