mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-10 23:54:08 +02:00
update all to new on api + add animation support to tabs
This commit is contained in:
@@ -9,11 +9,11 @@ We believe you should be able to use all plugins provided by Bootstrap purely th
|
||||
|
||||
We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
|
||||
|
||||
$('body').unbind('.data-api')
|
||||
$('body').off('.data-api')
|
||||
|
||||
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
|
||||
|
||||
$('body').unbind('.alert.data-api')
|
||||
$('body').off('.alert.data-api')
|
||||
|
||||
---
|
||||
|
||||
|
2
js/bootstrap-alert.js
vendored
2
js/bootstrap-alert.js
vendored
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
$.support.transition && $element.hasClass('fade') ?
|
||||
$element.bind($.support.transition.end, removeElement) :
|
||||
$element.on($.support.transition.end, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
|
6
js/bootstrap-modal.js
vendored
6
js/bootstrap-modal.js
vendored
@@ -96,7 +96,7 @@
|
||||
function hideWithTransition() {
|
||||
var that = this
|
||||
, timeout = setTimeout(function () {
|
||||
that.$element.unbind($.support.transition.end)
|
||||
that.$element.off($.support.transition.end)
|
||||
hideModal.call(that)
|
||||
}, 500)
|
||||
|
||||
@@ -156,11 +156,11 @@
|
||||
function escape() {
|
||||
var that = this
|
||||
if (this.isShown && this.options.keyboard) {
|
||||
$(document).bind('keyup.dismiss.modal', function ( e ) {
|
||||
$(document).on('keyup.dismiss.modal', function ( e ) {
|
||||
e.which == 27 && that.hide()
|
||||
})
|
||||
} else if (!this.isShown) {
|
||||
$(document).unbind('keyup.dismiss.modal')
|
||||
$(document).off('keyup.dismiss.modal')
|
||||
}
|
||||
}
|
||||
|
||||
|
5
js/bootstrap-popover.js
vendored
5
js/bootstrap-popover.js
vendored
@@ -63,8 +63,7 @@
|
||||
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="popover" />')
|
||||
.html(this.options.template)
|
||||
this.$tip = $(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
@@ -90,7 +89,7 @@
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
|
||||
placement: 'right'
|
||||
, content: ''
|
||||
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
|
||||
, template: '<div class="popover"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
|
||||
})
|
||||
|
||||
}( window.jQuery )
|
2
js/bootstrap-scrollspy.js
vendored
2
js/bootstrap-scrollspy.js
vendored
@@ -27,7 +27,7 @@
|
||||
function ScrollSpy( element ) {
|
||||
var process = $.proxy(this.process, this)
|
||||
|
||||
this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
|
||||
this.$scrollElement = $(element).on('scroll.scroll.data-api', process)
|
||||
this.selector = (this.$scrollElement.attr('data-target')
|
||||
|| this.$scrollElement.attr('href')
|
||||
|| '') + ' .nav li > a'
|
||||
|
47
js/bootstrap-tab.js
vendored
47
js/bootstrap-tab.js
vendored
@@ -52,26 +52,45 @@
|
||||
$href = $(href)
|
||||
|
||||
this.activate($this.parent('li'), $ul)
|
||||
this.activate($href, $href.parent())
|
||||
|
||||
$this.trigger({
|
||||
type: 'shown'
|
||||
, relatedTarget: previous
|
||||
this.activate($href, $href.parent(), function () {
|
||||
$this.trigger({
|
||||
type: 'shown'
|
||||
, relatedTarget: previous
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
, activate: function ( element, container ) {
|
||||
container
|
||||
.find('> .active')
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
, activate: function ( element, container, callback) {
|
||||
var $active = container.find('> .active')
|
||||
, transition = callback
|
||||
&& $.support.transition
|
||||
&& $active.hasClass('fade')
|
||||
|
||||
element.addClass('active')
|
||||
function next() {
|
||||
$active
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
|
||||
if ( element.parent('.dropdown-menu') ) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
element.addClass('active')
|
||||
|
||||
if (transition) {
|
||||
element[0].offsetWidth // reflow for transition
|
||||
element.addClass('in')
|
||||
}
|
||||
|
||||
if ( element.parent('.dropdown-menu') ) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
}
|
||||
|
||||
callback && callback()
|
||||
}
|
||||
|
||||
transition ?
|
||||
$active.one($.support.transition.end, next) :
|
||||
next()
|
||||
|
||||
$active.removeClass('in')
|
||||
}
|
||||
}
|
||||
|
||||
|
6
js/bootstrap-twipsy.js
vendored
6
js/bootstrap-twipsy.js
vendored
@@ -167,7 +167,7 @@
|
||||
}
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
$tip.bind( $.support.transition.end, removeElement) :
|
||||
$tip.on($.support.transition.end, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
}
|
||||
|
||||
, tip: function () {
|
||||
return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
|
||||
return this.$tip = this.$tip || $(this.options.template)
|
||||
}
|
||||
|
||||
, validate: function () {
|
||||
@@ -256,7 +256,7 @@
|
||||
, placement: 'above'
|
||||
, trigger: 'hover'
|
||||
, title: ''
|
||||
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
|
||||
, template: '<div class="twipsy"><div class="twipsy-arrow"></div><div class="twipsy-inner"></div></div>'
|
||||
}
|
||||
|
||||
}( window.jQuery )
|
Reference in New Issue
Block a user