Created
March 25, 2017 12:03
-
-
Save yoavmatchulsky/b7e1c9bb6f79b72d4de72e52a4ca1f11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_event_supported : (event) -> | |
eventName = "on#{event}" | |
element = document.createElement('div') | |
supported_in_ff = -> | |
element.setAttribute eventName, 'return;' | |
typeof element[eventName] is 'function' | |
supported = eventName in element || supported_in_ff() | |
element = null | |
supported | |
touch_event = if is_event_supported('touchstart') then 'touchstart' else 'click' | |
$elem.on(touch_event, (e) -> ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment