Created
June 27, 2016 08:22
-
-
Save janily/df11da37f074b522551e691b66816f3a to your computer and use it in GitHub Desktop.
兼容手机和PC的点击事件代码,支持touch事件则用touch,否则使用click
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
var clickOrTouch = (('ontouchstart' in window)) ? 'touchstart' : 'click'; | |
$("elemeng").on("clickOrTouch",function(){ | |
.... | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment