aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-collapse.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-03-24 18:20:09 -0700
committerJacob Thornton <[email protected]>2012-03-24 18:20:09 -0700
commitbccc2cb7191eb54a4d67563625a748d7ecd381d4 (patch)
treec4562643867c197b7f7f5792694e3e10aab8de52 /js/bootstrap-collapse.js
parentef5ac02b698ffab3a42d21f20859b70df85543c0 (diff)
downloadbootstrap-bccc2cb7191eb54a4d67563625a748d7ecd381d4.tar.xz
bootstrap-bccc2cb7191eb54a4d67563625a748d7ecd381d4.zip
add preventDefault support for all inital event types (show, close, hide, etc.) + fix small bug with scrollspy.last
Diffstat (limited to 'js/bootstrap-collapse.js')
-rw-r--r--js/bootstrap-collapse.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/js/bootstrap-collapse.js b/js/bootstrap-collapse.js
index 16b91eb24..478eea391 100644
--- a/js/bootstrap-collapse.js
+++ b/js/bootstrap-collapse.js
@@ -61,7 +61,7 @@
}
this.$element[dimension](0)
- this.transition('addClass', 'show', 'shown')
+ this.transition('addClass', $.Event('show'), 'shown')
this.$element[dimension](this.$element[0][scroll])
}
@@ -70,7 +70,7 @@
if (this.transitioning) return
dimension = this.dimension()
this.reset(this.$element[dimension]())
- this.transition('removeClass', 'hide', 'hidden')
+ this.transition('removeClass', $.Event('hide'), 'hidden')
this.$element[dimension](0)
}
@@ -95,11 +95,13 @@
that.$element.trigger(completeEvent)
}
+ this.$element.trigger(startEvent)
+
+ if (startEvent.isDefaultPrevented()) return
+
this.transitioning = 1
- this.$element
- .trigger(startEvent)
- [method]('in')
+ this.$element[method]('in')
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :