You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.8KB

  1. /* ========================================================================
  2. * Bootstrap: transition.js v3.3.2
  3. * http://getbootstrap.com/javascript/#transitions
  4. * ========================================================================
  5. * Copyright 2011-2015 Twitter, Inc.
  6. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7. * ======================================================================== */
  8. +function ($) {
  9. 'use strict';
  10. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  11. // ============================================================
  12. function transitionEnd() {
  13. var el = document.createElement('bootstrap')
  14. var transEndEventNames = {
  15. WebkitTransition : 'webkitTransitionEnd',
  16. MozTransition : 'transitionend',
  17. OTransition : 'oTransitionEnd otransitionend',
  18. transition : 'transitionend'
  19. }
  20. for (var name in transEndEventNames) {
  21. if (el.style[name] !== undefined) {
  22. return { end: transEndEventNames[name] }
  23. }
  24. }
  25. return false // explicit for ie8 ( ._.)
  26. }
  27. // http://blog.alexmaccaw.com/css-transitions
  28. $.fn.emulateTransitionEnd = function (duration) {
  29. var called = false
  30. var $el = this
  31. $(this).one('bsTransitionEnd', function () { called = true })
  32. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  33. setTimeout(callback, duration)
  34. return this
  35. }
  36. $(function () {
  37. $.support.transition = transitionEnd()
  38. if (!$.support.transition) return
  39. $.event.special.bsTransitionEnd = {
  40. bindType: $.support.transition.end,
  41. delegateType: $.support.transition.end,
  42. handle: function (e) {
  43. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  44. }
  45. }
  46. })
  47. }(jQuery);