Merge pull request #10 from hermanschutte/master

Update use of the reserved default keyword being used as an option
This commit is contained in:
Chris Polis 2011-09-30 09:55:24 -07:00
commit 4cddd808fc
3 changed files with 7 additions and 5 deletions

View file

@ -35,7 +35,7 @@ Call __pagify__ on the aforementioned div and pass in options. _The only require
``` js ``` js
$('#page_holder').pagify({ $('#page_holder').pagify({
pages: ['home', 'about', 'contact'], pages: ['home', 'about', 'contact'],
default: 'home' // The name of a page or null for an empty div 'default': 'home' // The name of a page or null for an empty div
}); });
``` ```

View file

@ -13,7 +13,7 @@
$('#page_holder').pagify({ $('#page_holder').pagify({
pages: ['about', 'usage', 'options'], pages: ['about', 'usage', 'options'],
animation: 'fadeIn', animation: 'fadeIn',
default: 'about', 'default': 'about',
cache: true cache: true
}); });
}); });

View file

@ -13,7 +13,7 @@
this.defaults = { this.defaults = {
pages: [], pages: [],
default: null, 'default': null,
animation: 'show', animation: 'show',
onChange: function (page) {}, onChange: function (page) {},
cache: false cache: false
@ -26,7 +26,7 @@
// Page is selected from: passed in value, window.location, default // Page is selected from: passed in value, window.location, default
if(!page) { if(!page) {
page = window.location.hash.replace('#','') || self.settings.default; page = window.location.hash.replace('#','') || self.settings['default'];
} }
// Load page content from cache // Load page content from cache
@ -50,7 +50,7 @@
// Load initial page - current hash or default page // Load initial page - current hash or default page
if(window.location.hash) self.switchPage(); if(window.location.hash) self.switchPage();
else if(self.settings.default) self.switchPage(self.settings.default); else if(self.settings['default']) self.switchPage(self.settings['default']);
}; };
@ -69,3 +69,5 @@
}; };
})(jQuery); })(jQuery);