From 59a7648dcac6f166d8a0c9fa3e8e01db704704f7 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 8 Dec 2010 21:56:02 +0000 Subject: [PATCH] first commit --- README | 0 demo/1/index.html | 172 ++++++++++++++++++ demo/2/index.html | 329 +++++++++++++++++++++++++++++++++++ scripts/quickpager.jquery.js | 111 ++++++++++++ 4 files changed, 612 insertions(+) create mode 100644 README create mode 100755 demo/1/index.html create mode 100755 demo/2/index.html create mode 100755 scripts/quickpager.jquery.js diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/demo/1/index.html b/demo/1/index.html new file mode 100755 index 0000000..d2fb573 --- /dev/null +++ b/demo/1/index.html @@ -0,0 +1,172 @@ + + + + +quickPager - easy jQuery paging plugin + + + + + + + +

SimplePager demo page

+

back to blog post

+ +
+    $("ul.paging").quickPager();
+            
+
+ + + + +

Second example

+ +
+   $("ul.paging2").quickPager({pagerLocation:"both"});
+            
+
+ + +

+ + + + + diff --git a/demo/2/index.html b/demo/2/index.html new file mode 100755 index 0000000..fb59e76 --- /dev/null +++ b/demo/2/index.html @@ -0,0 +1,329 @@ + + + + +quickPager - easy jQuery paging plugin + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dasdas + +
1Table CellTable CellTable Cell
2Table CellTable CellTable Cell
3Table CellTable CellTable Cell
4Table CellTable CellTable Cell
5Table CellTable CellTable Cell
6Table CellTable CellTable Cell
7Table CellTable CellTable Cell
8Table CellTable CellTable Cell
9Table CellTable CellTable Cell
10Table CellTable CellTable Cell
12Table CellTable CellTable Cell
13Table CellTable CellTable Cell
14Table CellTable CellTable Cell
15Table CellTable CellTable Cell
16Table CellTable CellTable Cell
17Table CellTable CellTable Cell
18Table CellTable CellTable Cell
19Table CellTable CellTable Cell
20Table CellTable CellTable Cell
21Table CellTable CellTable Cell
22Table CellTable CellTable Cell
23Table CellTable CellTable Cell
24Table CellTable CellTable Cell
25Table CellTable CellTable Cell
26Table CellTable CellTable Cell
27Table CellTable CellTable Cell
28Table CellTable CellTable Cell
29Table CellTable CellTable Cell
30Table CellTable CellTable Cell
31Table CellTable CellTable Cell
32Table CellTable CellTable Cell
33Table CellTable CellTable Cell
34Table CellTable CellTable Cell
35Table CellTable CellTable Cell
+
+ + + + + + diff --git a/scripts/quickpager.jquery.js b/scripts/quickpager.jquery.js new file mode 100755 index 0000000..5363fe6 --- /dev/null +++ b/scripts/quickpager.jquery.js @@ -0,0 +1,111 @@ +//------------------------------------------------- +// Quick Pager jquery plugin +// Created by dan and emanuel @geckonm.com +// www.geckonewmedia.com +// +// v1.1 +// 18/09/09 * bug fix by John V - http://blog.geekyjohn.com/ +//------------------------------------------------- + +(function($) { + + $.fn.quickPager = function(options) { + + var defaults = { + pageSize: 10, + currentPage: 1, + holder: null, + pagerLocation: "after" + }; + + var options = $.extend(defaults, options); + + + return this.each(function() { + + + var selector = $(this); + var pageCounter = 1; + + selector.wrap("
"); + + selector.children().each(function(i){ + + if(i < pageCounter*options.pageSize && i >= (pageCounter-1)*options.pageSize) { + $(this).addClass("simplePagerPage"+pageCounter); + } + else { + $(this).addClass("simplePagerPage"+(pageCounter+1)); + pageCounter ++; + } + + }); + + // show/hide the appropriate regions + selector.children().hide(); + selector.children(".simplePagerPage"+options.currentPage).show(); + + if(pageCounter <= 1) { + return; + } + + //Build pager navigation + var pageNav = ""; + + if(!options.holder) { + switch(options.pagerLocation) + { + case "before": + selector.before(pageNav); + break; + case "both": + selector.before(pageNav); + selector.after(pageNav); + break; + default: + selector.after(pageNav); + } + } + else { + $(options.holder).append(pageNav); + } + + //pager navigation behaviour + selector.parent().find(".simplePagerNav a").click(function() { + + //grab the REL attribute + var clickedLink = $(this).attr("rel"); + options.currentPage = clickedLink; + + if(options.holder) { + $(this).parent("li").parent("ul").parent(options.holder).find("li.currentPage").removeClass("currentPage"); + $(this).parent("li").parent("ul").parent(options.holder).find("a[rel='"+clickedLink+"']").parent("li").addClass("currentPage"); + } + else { + //remove current current (!) page + $(this).parent("li").parent("ul").parent(".simplePagerContainer").find("li.currentPage").removeClass("currentPage"); + //Add current page highlighting + $(this).parent("li").parent("ul").parent(".simplePagerContainer").find("a[rel='"+clickedLink+"']").parent("li").addClass("currentPage"); + } + + //hide and show relevant links + selector.children().hide(); + selector.find(".simplePagerPage"+clickedLink).show(); + + return false; + }); + }); + } + + +})(jQuery); +