tags:

views:

31

answers:

1

I'm using a javascript pagination div that I found on dynamicdrive.com, so I've been cut and pasting - I'm no javascript junkie, far from it! Right now, I have a pagination bar at the top of the article and one at the bottom, but when I use the one at the bottom, it sends me to the bottom of the next page, instead of the top. So I click next and then have to scroll up - is there a way I can tweak this so that it sends me directly to the top of the next page?

This is the pagination version I'm using - it's Demo 3 on: http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm

Thanks in advance for any tips you can give me!

+1  A: 

It doesn't look like there is a way to do this using the virtualpagination.js library. You should be able to wrap the library's main navigate function with your own funciton that will bring the scroll back to the top.

Try putting this in a javascript file, and including it after the virtualpaginate.js file:

virtualpaginate.prototype._navigate = virtualpaginate.prototype.navigate;
virtualpaginate.prototype.navigate = function (keyword) {
  window.location = '#wrapperDivId';
  this._navigate(keyword);
}

And then wrap your pagination content in a div like so:

<div id="wrapperDivId">
  ... your content here ...
</div>
pkaeding