Hello all,

I am messing around with the jPaginate files, essentially a pagination script using jQuery. I have the mark up working, but I am just messing around (not a real expert in JavaScript) and I have a simple question. When the user clicks on the next page icon, the next page does indeed load. However I would like the page to load and for the browser to scroll back to the top of the new page. Is there a way to do this in HTML / Javascript?

Many thanks in advance, just wanted to see if there are ways to do this, I have code if anyone needs to see that but I think my problem exists purely because of my lack of understanding of some web design tricks.


Here is the piece that is actually driving the change in page:

<script type="text/javascript" src="jquery-1.3.2.js"></script>
		<script src="jquery.paginate.js" type="text/javascript"></script>
		<script type="text/javascript">
		$(function() {
				count 		: 6,
				start 		: 1,
				display     : 5,
				border					: true,
				border_color			: '#fff',
				text_color  			: '#fff',
				background_color    	: '#c62606',	
				border_hover_color		: '#ccc',
				text_hover_color  		: '#000',
				background_hover_color	: '#fff', 
				images					: false,
				mouse					: 'press',
				onChange     			: function(page){

So the fix was pretty simple, inside the 'onChange' function, i just added:


And bingo it works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.