diff --git a/js/bootstrap-alert.js b/js/bootstrap-alert.js index 8500bd273c..ea3209ed19 100644 --- a/js/bootstrap-alert.js +++ b/js/bootstrap-alert.js @@ -84,7 +84,7 @@ * ============== */ $(function () { - $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) + $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) }) }(window.jQuery); \ No newline at end of file diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js index cc2d0048fd..4c0b725c7a 100644 --- a/js/bootstrap-button.js +++ b/js/bootstrap-button.js @@ -86,7 +86,7 @@ * =============== */ $(function () { - $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { + $(document).on('click.button.data-api', '[data-toggle^=button]', function ( e ) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 0d7167e1c2..8751b320cc 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -164,7 +164,7 @@ * ================= */ $(function () { - $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { + $(document).on('click.carousel.data-api', '[data-slide]', function ( e ) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) diff --git a/js/bootstrap-collapse.js b/js/bootstrap-collapse.js index 7345758000..781e274374 100644 --- a/js/bootstrap-collapse.js +++ b/js/bootstrap-collapse.js @@ -144,7 +144,7 @@ * ==================== */ $(function () { - $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { + $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href , target = $this.attr('data-target') || e.preventDefault() diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index 0ef9b0f9d2..5a2766fdea 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -141,7 +141,7 @@ $(function () { $('html') .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) - $('body') + $(document) .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index d53f13a00c..8a40c2d4e6 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -216,7 +216,7 @@ * ============== */ $(function () { - $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { + $(document).on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { var $this = $(this) , href = $this.attr('href') , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 diff --git a/js/bootstrap-tab.js b/js/bootstrap-tab.js index 4fb3c38399..14387a1bf4 100644 --- a/js/bootstrap-tab.js +++ b/js/bootstrap-tab.js @@ -126,7 +126,7 @@ * ============ */ $(function () { - $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index 78cbe9faa5..ab1d66879d 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -298,7 +298,7 @@ * ================== */ $(function () { - $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { + $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { var $this = $(this) if ($this.data('typeahead')) return e.preventDefault()