aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-collapse.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-04-14 17:16:37 -0700
committerMark Otto <[email protected]>2012-04-14 17:16:37 -0700
commitce30d19c1507e71199f7dbbf680cf0d2b0ea6477 (patch)
tree1279731abc8cf141a3fd683282ad2cae32ae6653 /js/bootstrap-collapse.js
parentdbde2dc9e40f077af4fcaa1714ade7bc94398da9 (diff)
parent3408064d00bc1e4322c3ea1575bc2cab5aaa2be2 (diff)
downloadbootstrap-ce30d19c1507e71199f7dbbf680cf0d2b0ea6477.tar.xz
bootstrap-ce30d19c1507e71199f7dbbf680cf0d2b0ea6477.zip
Merge branch '2.0.3-wip' of github.com:twitter/bootstrap into 2.0.3-wip
Conflicts: docs/assets/bootstrap.zip
Diffstat (limited to 'js/bootstrap-collapse.js')
-rw-r--r--js/bootstrap-collapse.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/js/bootstrap-collapse.js b/js/bootstrap-collapse.js
index 9f462e6bc..30e139cf8 100644
--- a/js/bootstrap-collapse.js
+++ b/js/bootstrap-collapse.js
@@ -18,16 +18,20 @@
* ============================================================ */
-!function ( $ ) {
+!function ($) {
- "use strict"
+ "use strict"; // jshint ;_;
- var Collapse = function ( element, options ) {
- this.$element = $(element)
+
+ /* COLLAPSE PUBLIC CLASS DEFINITION
+ * ================================ */
+
+ var Collapse = function (element, options) {
+ this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options)
- if (this.options["parent"]) {
- this.$parent = $(this.options["parent"])
+ if (this.options.parent) {
+ this.$parent = $(this.options.parent)
}
this.options.toggle && this.toggle()
@@ -53,7 +57,6 @@
dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
- hasData
if (actives && actives.length) {
hasData = actives.data('collapse')
@@ -75,7 +78,7 @@
this.$element[dimension](0)
}
- , reset: function ( size ) {
+ , reset: function (size) {
var dimension = this.dimension()
this.$element
@@ -83,12 +86,12 @@
[dimension](size || 'auto')
[0].offsetWidth
- this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this
}
- , transition: function ( method, startEvent, completeEvent ) {
+ , transition: function (method, startEvent, completeEvent) {
var that = this
, complete = function () {
if (startEvent == 'show') that.reset()
@@ -107,18 +110,19 @@
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
- }
+ }
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
- }
+ }
}
- /* COLLAPSIBLE PLUGIN DEFINITION
+
+ /* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
- $.fn.collapse = function ( option ) {
+ $.fn.collapse = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
@@ -149,4 +153,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file