Skip to content

Instantly share code, notes, and snippets.

View Rayi's full-sized avatar

Rayi Rayi

  • Chengdu, China
View GitHub Profile
@Rayi
Rayi / rmDelayOnclick.js
Created June 19, 2012 18:00 — forked from lbj96347/rmDelayOnclick.js
RemoveDedayOnclick
/*when you use an onclick event in an html element,iPhone webkit browser would have a delay.So you should deal with it.This part of js would help you.You just need to add this file in your html page and use ontouchstart/ontouchend/ontouchmove to replace onclick event */
/* 当你在使用onclick事件的时候,iPhone手机上面的safari浏览器会对事件产生一个延误(大概是0.3秒左右),这个时候你必须对这个事件作出一些处理。 然后用ontouchstart ontouchend ontouchmove去代替原本的onclick事件即可*/
function NoClickDelay(el) {
this.element = el;
if( window.Touch ) this.element.addEventListener('touchstart', this, false);
}
NoClickDelay.prototype = {