code left out of last commit

This commit is contained in:
Chris Polis 2011-09-29 21:42:35 -07:00
parent 765dee9459
commit 9bc21c5f78

View file

@ -15,6 +15,7 @@
pages: [], pages: [],
default: null, default: null,
animation: 'show', animation: 'show',
onChange: function (page) {},
cache: false cache: false
}; };
this.settings = $.extend({}, this.defaults, options); this.settings = $.extend({}, this.defaults, options);
@ -31,11 +32,13 @@
// Load page content from cache // Load page content from cache
if(self.settings.cache) { if(self.settings.cache) {
$(self).hide().html(self.pages[page])[self.settings.animation](); $(self).hide().html(self.pages[page])[self.settings.animation]();
self.settings.onChange(page);
// Fetch page content // Fetch page content
} else { } else {
$.get(page+'.html', function(content) { $.get(page+'.html', function(content) {
$(self).hide().html(content)[self.settings.animation](); $(self).hide().html(content)[self.settings.animation]();
self.settings.onChange(page);
}, 'text'); }, 'text');
} }
} }