ffffng/app/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/transition.js

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-05-12 20:08:19 +02:00
/* ========================================================================
2017-05-13 13:25:33 +02:00
* Bootstrap: transition.js v3.3.7
2014-05-12 20:08:19 +02:00
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
2017-05-13 13:25:33 +02:00
* Copyright 2011-2016 Twitter, Inc.
2014-05-12 20:08:19 +02:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
2014-08-10 12:02:48 +02:00
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
2014-05-12 20:08:19 +02:00
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
2014-08-10 12:02:48 +02:00
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
2014-05-12 20:08:19 +02:00
})
}(jQuery);