PDA

View Full Version : Virtual Paging Script - Flat view and show all



manga101
06-18-2007, 06:28 PM
1) Script Title: Virtual Pagination Script
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm

3) Describe problem:

since, DD doesnt support duplicate scripts on the same page, is there a way to also add a "show all" options to the "flat view"?

I have the pagination working, with many pages, I would rather have the pagination numbering at top and bottom, but duplicating the script wont work.. so instead is there a way to put "show" all to the right of the "next" ?

So basically, i give the user the options to view page by page or view all the page at once.


thx

ddadmin
06-18-2007, 08:56 PM
Actually, this script does support duplicate instances of itself on the page, as do most newer scripts on DD. What you're asking is different, that is, how to duplicate the pagination interface for a pagination instance on both the top and bottom of the content. Right now there's no easy way, though I'll most likely add such a feature down the line.


so instead is there a way to put "show" all to the right of the "next" ?

Yep, that's certainly do-able. Add the below new function to the end of virtualpaginate.js:


virtualpaginate.prototype.showall=function(){
for (var i=0; i<this.pieces.length; i++)
this.pieces[i].style.display="block"
}

Then on your HTML page, within your pagination interface, you would call instance.showall() to show all contents at once:


<!-- Pagination DIV for Demo 4 -->
<div id="galleryalt" class="paginationstyle" style="width: 300px; text-align: left">
<a href="#" rel="previous"><</a> <span class="flatview"></span> <a href="#" rel="next">></a> <a href="javascript:gallery.showall()">All</a>
</div>


<!-- Initialize Demo 4 -->
<script type="text/javascript">
var gallery=new virtualpaginate("virtualpage4", 1)
gallery.buildpagination("galleryalt", ["castle", "park", "harvest", "country"])
</script>

manga101
08-02-2007, 05:44 PM
awesome thx! love DD!