From a91a407bd60a266f928b5fea70d3c4332394b3c8 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 4 Oct 2011 21:48:53 -0700 Subject: start updating to data- driven js --- js/bootstrap-alerts.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/bootstrap-alerts.js') diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js index 82bcac524..4498270cb 100644 --- a/js/bootstrap-alerts.js +++ b/js/bootstrap-alerts.js @@ -53,7 +53,7 @@ var Alert = function ( content, selector ) { this.$element = $(content) - .delegate(selector || '.close', 'click', this.close) + .delegate('[data-alert-dismiss]', 'click', this.close) } Alert.prototype = { @@ -62,6 +62,8 @@ var $element = $(this).parent('.alert-message') e && e.preventDefault() + e && e.stopPropagation() + $element.removeClass('in') function removeElement () { @@ -98,7 +100,7 @@ } $(document).ready(function () { - new Alert($('body'), '.alert-message[data-alert] .close') + new Alert($('body')) }) })( window.jQuery || window.ender ) \ No newline at end of file -- cgit v1.2.3