From 5f65df9e2db7c16c3c64930331a467e18501e20c Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 10 Sep 2011 14:04:22 -0700 Subject: add some more events to alerts and modal and update docs --- js/bootstrap-alerts.js | 9 +++++---- js/bootstrap-modal.js | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js index e27ac6482..4c9c9394d 100644 --- a/js/bootstrap-alerts.js +++ b/js/bootstrap-alerts.js @@ -34,10 +34,11 @@ var Alert = function ( content ) { var that = this this.$element = $(content) - this.$element.delegate('.close', 'click', function (e) { - e.preventDefault() - that.close() - }) + .bind('alert:hide', $.proxy(this.close, this)) + .delegate('.close', 'click', function (e) { + e.preventDefault() + that.close() + }) } Alert.prototype = { diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 54cbad4b1..de972a8aa 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -66,7 +66,7 @@ .show() setTimeout(function () { - that.$element.addClass('in') + that.$element.addClass('in').trigger('modal:shown') that.$backdrop && that.$backdrop.addClass('in') }, 1) @@ -86,8 +86,10 @@ this.$element.removeClass('in') function removeElement () { - that.$element.unbind(transitionEnd) - that.$element.detach() + that.$element + .unbind(transitionEnd) + .detach() + .trigger('modal:hidden') } $.support.transition && this.$element.hasClass('fade') ? -- cgit v1.2.3