Sha256: 52032158627c04130dda3bd622ae59a591396d1446e440e05a45e94451b89ce1

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

# Mice: transition.coffee

# Copyright (c) 2014 Miclle
# Licensed under MIT (https://github.com/miclle/mice/blob/master/LICENSE)

"use strict"
(($) ->

  # CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  transitionEnd = ->
    element = document.createElement("mice")
    transEndEventNames =
      WebkitTransition : "webkitTransitionEnd"
      MozTransition    : "transitionend"
      OTransition      : "oTransitionEnd otransitionend"
      transition       : "transitionend"

    return end: transEndEventNames[name] for name of transEndEventNames when element.style[name] isnt `undefined`
    false # explicit for ie8 (  ._.)

  # http://blog.alexmaccaw.com/css-transitions
  $.fn.emulateTransitionEnd = (duration) =>
    called = false
    $(this).one "miceTransitionEnd", -> called = true
    setTimeout (-> $(_this).trigger $.support.transition.end unless called), duration
    @

  $ ->
    $.support.transition = transitionEnd()
    return unless $.support.transition
    $.event.special.miceTransitionEnd =
      bindType     : $.support.transition.end
      delegateType : $.support.transition.end
      handle       : (e) -> e.handleObj.handler.apply @, arguments if $(e.target).is(@)

) jQuery

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mice-0.2.10 vendor/assets/javascripts/mice/transition.coffee
mice-0.2.9 vendor/assets/javascripts/mice/transition.coffee
mice-0.2.8 vendor/assets/javascripts/mice/transition.coffee
mice-0.2.7 vendor/assets/javascripts/mice/transition.coffee