From 07ec02327c0528685b5f9cdc6d5b68c2e54c0402 Mon Sep 17 00:00:00 2001 From: tazmaniax Date: Thu, 9 Aug 2012 17:53:22 +0200 Subject: [PATCH 1/3] Update js/bootstrap-toggle.js Applies Toggle to each element matched --- js/bootstrap-toggle.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-toggle.js b/js/bootstrap-toggle.js index dfad874..f2540d2 100644 --- a/js/bootstrap-toggle.js +++ b/js/bootstrap-toggle.js @@ -80,7 +80,9 @@ * Toggle Definition */ $.fn.toggle = function (options) { - return new Toggle(this, typeof options == 'object' ? options : {}) + return this.each(function() { + new Toggle(this, typeof options == 'object' ? options : {}) + }); } $.fn.toggle.defaults = { From 4a635e83c8e86cfa3651294afd3c1cdb740f3848 Mon Sep 17 00:00:00 2001 From: tazmaniax Date: Thu, 9 Aug 2012 17:54:06 +0200 Subject: [PATCH 2/3] Update js/bootstrap-toggle.js removed tabs --- js/bootstrap-toggle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/bootstrap-toggle.js b/js/bootstrap-toggle.js index f2540d2..49165de 100644 --- a/js/bootstrap-toggle.js +++ b/js/bootstrap-toggle.js @@ -81,8 +81,8 @@ */ $.fn.toggle = function (options) { return this.each(function() { - new Toggle(this, typeof options == 'object' ? options : {}) - }); + new Toggle(this, typeof options == 'object' ? options : {}) + }); } $.fn.toggle.defaults = { From c162f2d6b1a2e2168e231cbca84cb16a1dac5e8a Mon Sep 17 00:00:00 2001 From: tazmaniax Date: Thu, 9 Aug 2012 17:55:43 +0200 Subject: [PATCH 3/3] Update js/bootstrap-toggle.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passed the checkbox back in the onClick hander so it can interrogated directly --- js/bootstrap-toggle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/bootstrap-toggle.js b/js/bootstrap-toggle.js index 49165de..71e54d7 100644 --- a/js/bootstrap-toggle.js +++ b/js/bootstrap-toggle.js @@ -37,7 +37,7 @@ // Setup Click this.$element.click(function (e) { - if(self.options.onClick) self.options.onClick(e, self.$checkbox.is(':checked')) + if(self.options.onClick) self.options.onClick(e, self.$checkbox, self.$checkbox.is(':checked')) self.toggle() }); }