Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions tools.tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
* Revision: ${revision}
*/
(function($) {


var namespace = '.tools-tabs';

// static constructs
$.tools = $.tools || {};

Expand Down Expand Up @@ -103,7 +105,7 @@

// bind all callbacks from configuration
$.each(conf, function(name, fn) {
if ($.isFunction(fn)) { $self.bind(name, fn); }
if ($.isFunction(fn)) { $self.bind(name + namespace, fn); }
});


Expand Down Expand Up @@ -194,7 +196,7 @@
},

bind: function(name, fn) {
$self.bind(name, fn);
$self.bind(name + namespace, fn);
return self;
},

Expand All @@ -209,14 +211,23 @@
unbind: function(name) {
$self.unbind(name);
return self;
}

},

destroy: function() {
this.unbind(namespace);
this.getTabs()
.unbind(namespace)
.parent().removeData('tabs');
this.getPanes()
.find("a[href^=#]").unbind(namespace)
.end().show();
}
});


// setup click actions for each tab
tabs.each(function(i) {
$(this).bind(conf.event, function(e) {
$(this).bind(conf.event + namespace, function(e) {
self.click(i, e);
return false;
});
Expand All @@ -232,7 +243,7 @@
}

// cross tab anchor link
panes.find("a[href^=#]").click(function(e) {
panes.find("a[href^=#]").bind('click' + namespace, function(e) {
self.click($(this).attr("href"), e);
});
}
Expand Down Expand Up @@ -282,4 +293,3 @@

}) (jQuery);