From 9c7dc8e07c4d8c17d096211c09449eced2e594bb Mon Sep 17 00:00:00 2001 From: Jim Puls Date: Fri, 16 Sep 2011 16:13:55 -0700 Subject: [PATCH] Add an onChange callback --- pagify.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pagify.js b/pagify.js index 8c321a8..051f1ce 100644 --- a/pagify.js +++ b/pagify.js @@ -15,6 +15,7 @@ pages: [], default: null, animation: 'show', + onChange: function (page) {}, cache: false }; this.settings = $.extend({}, this.defaults, options); @@ -27,11 +28,13 @@ // Load page content from cache if(self.settings.cache) { $(self).hide().html(self.pages[page])[self.settings.animation](); + self.settings.onChange(page); // Fetch page content } else { $.get(page+'.html', function(content) { $(self).hide().html(content)[self.settings.animation](); + self.settings.onChange(page); }, 'text'); } }