One easy way is simply to give the outermost DIV that contains the paginated contents a unique ID, for example:
Code:
<div id="contentarea" style="width: 450px; border: 1px dashed gray; padding: 10px;">
//paginated contents defined here
</div>
Then at the end of function showpage() inside the .js file, add the 3 line in red that when run scrolls the page back up to the desired location on the page:
Code:
if (this.cpspan.length>0){ //if <span class="paginateinfo> element is present, update it with the most current info (ie: Page 3/4)
for (var p=0; p<this.cpspan.length; p++)
this.cpspan[p].innerHTML='Page '+(this.currentpage+1)+'/'+this.pagecount
}
var contentArea=document.getElementById(config.divid)
if (contentArea && contentArea.scrollIntoView)
document.getElementById(config.divid).scrollIntoView()
}
Before the above can work though, you need to tell the script when initializing it the ID you've given the outermost DIV:
Code:
<script type="text/javascript">
var pagecontent=new virtualpaginate({
divid: "contentarea",
piececlass: "virtualpage", //class of container for each piece of content
piececontainer: "div", //container element type (ie: "div", "p" etc)
pieces_per_page: 1, //Pieces of content to show per page (1=1 piece, 2=2 pieces etc)
defaultpage: 0, //Default page selected (0=1st page, 1=2nd page etc). Persistence if enabled overrides this setting.
persist: false //Remember last viewed page and recall it when user returns within a browser session?
})
pagecontent.buildpagination(["paginatediv"])
</script>
Note that I've yet to test the above, but it should work.
Bookmarks