Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Provide hooks for custom show/hide animations via base:{ show:func, h…

…ide:func } Closes #2
  • Loading branch information...
commit 40cb93fa13146b4eef496845e2a92276167b0a52 1 parent 5d799d3
@andykent authored
Showing with 19 additions and 4 deletions.
  1. +6 −0 changelog.txt
  2. +13 −4 lib/polypage.jquery.js
View
6 changelog.txt
@@ -1,6 +1,12 @@
PolyPage Change Log
+0.9 [dev]
+
+- Some performance improvements.
+- Provide hooks for custom show/hide animations via base:{ show:func, hide:func }
+
+
0.8.3
- Split extensions out into separate files to make mix'n'match easier.
View
17 lib/polypage.jquery.js
@@ -1,5 +1,5 @@
/*
-* PolyPage 0.8.3
+* PolyPage 0.9 [dev]
*
* Copyright (c) 2009 Andy Kent
* Dual licensed under the MIT and GPL licenses:
@@ -54,7 +54,9 @@
$.polypage.Base.DEFAULTS = {
prefix: 'pp',
- separator: '_'
+ separator: '_',
+ show: null,
+ hide: null
};
$.polypage.Base.prototype = {
@@ -159,10 +161,17 @@
var oldVis = $node.is(':visible');
var newVis = this.evaluate(this.extractDataFromClassName($node.attr('class')));
if(oldVis == newVis) return newVis;
- newVis ? $node.show() : $node.hide();
+ newVis ? this.show($node) : this.hide($node);
return newVis;
},
-
+
+ show: function($node){
+ $.isFunction(this.options.show) ? this.options.show($node) : $node.show();
+ },
+
+ hide: function($node){
+ $.isFunction(this.options.hide) ? this.options.hide($node) : $node.hide();
+ },
evaluate: function(input){
var str = input
.replace(new RegExp(this.separated('and'),'gi'),' && ')

0 comments on commit 40cb93f

Please sign in to comment.
Something went wrong with that request. Please try again.