使用iscroll滑动区域内的div onclick事件单击一次触发了两次 iscroll 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个问题是因为iscroll在判断滑动前,阻止了click事件,然后在滑动后,对原来的click事件进行了重构,一些设备上,比如你说的三星,并没有将默认的click阻止掉.所以,出现了类似双击的现象.好了,解释到此,给出解决方法:更改iscroll.js文件搜索onBeforeScrollStart方法,将其中的preventDefault禁止掉搜索_end方法,将其中模拟click事件的方法全部给注释掉.这个方式是可以解决的,具体深入,待共同研究了. 上边是凭印象写的,很不严谨,给个链接,自己取看吧.http://www.qinsiwang.com/theme_bbs_6/136.html 我也遇到这样的问题,最后通过2次点击时间差来解决。(500是2次点击时间差,单位ms)1、自己写一个fn-->myclick,然后onclick="myclick();"调用。代码:var t1 = null;//这个设置为全局function myclick(){ if (t1 == null){ t1 = new Date().getTime(); }else{ var t2 = new Date().getTime(); if(t2 - t1 < 500){ t1 = t2; return; }else{ t1 = t2; } } /*自己的代码*/}2、上面的代码,也可以写在iscroll.js(4.2.5)的_end方法中,要注意var t1是全局的3、国外论坛在iscroll.js(4.2.5)对应位置添加topOffset: 0,checkDOMChanges: false, // ExperimentalhandleClick: true,preventGhostClick: false, // prevent ghost clicks?防止2次点击ghostClickTimeout: 500, // timeout for ghost click prevention设置时间差/*** Prevents any real clicks.* See preventGhostClick portion of _end().*/_preventRealClick: function(e) { if (e._fake !== true) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); e.cancel = true; return false; }},_end: function (e) {......ev._fake = true;if (that.options.preventGhostClick) { //preventGhostClick: true, // prevent ghost real clicks on body document.body.addEventListener('click', that._preventRealClick, true); // until ghost click timeout expires setTimeout(function () { document.body.removeEventListener('click', that._preventRealClick, true); }, that.options.ghostClickTimeout);}target.dispatchEvent(ev);我用的是第1中方法,在每个点击的fn中都加入时间判断代码,这样比较繁琐,没办法,项目经理不给修改iscroll.js,建议直接在iscroll中加时间判断。希望对你有帮助 您好,最近用了iscroll ,我发现了一个问题,就是:使用了iscroll之后,内容里面的链接,默认弹出的是弹窗,在ipad上,就无法显示链接,请问这是为什么,有解决的方法吗?万分感谢!!!! .post(url,data),data可以是二维数组吗 请教iframe如何使用父层加载的jquery 事件或方法的调用 火狐与IE下兼容问题 关于函数写法的问题。。。各位大侠帮帮忙啊! window.open弹出窗口的标题栏文字如何更改? 注册页面表单检测问题 框架结构中可以在一个页面里调用另一个页面的JS函数么? 关于弹出一新窗口的问题。 javascript中使用<iframe>实现滚动窗口的问题 ~~~~~~~~~用jquery打开DIV中的Link,马上给分~~~~~~~~~~~ 为什么这段代码失效了!明明有if判断!
更改iscroll.js文件
搜索onBeforeScrollStart方法,将其中的preventDefault禁止掉
搜索_end方法,将其中模拟click事件的方法全部给注释掉.
这个方式是可以解决的,具体深入,待共同研究了.
http://www.qinsiwang.com/theme_bbs_6/136.html
1、自己写一个fn-->myclick,然后onclick="myclick();"调用。
代码:
var t1 = null;//这个设置为全局
function myclick(){
if (t1 == null){
t1 = new Date().getTime();
}else{
var t2 = new Date().getTime();
if(t2 - t1 < 500){
t1 = t2;
return;
}else{
t1 = t2;
}
}
/*自己的代码*/
}
2、上面的代码,也可以写在iscroll.js(4.2.5)的_end方法中,要注意var t1是全局的
3、国外论坛在iscroll.js(4.2.5)对应位置添加topOffset: 0,
checkDOMChanges: false, // Experimental
handleClick: true,
preventGhostClick: false, // prevent ghost clicks?防止2次点击
ghostClickTimeout: 500, // timeout for ghost click prevention设置时间差/**
* Prevents any real clicks.
* See preventGhostClick portion of _end().
*/
_preventRealClick: function(e) {
if (e._fake !== true) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
e.cancel = true;
return false;
}
},
_end: function (e) {......ev._fake = true;
if (that.options.preventGhostClick) { //preventGhostClick: true,
// prevent ghost real clicks on body
document.body.addEventListener('click', that._preventRealClick, true);
// until ghost click timeout expires
setTimeout(function () {
document.body.removeEventListener('click', that._preventRealClick, true);
}, that.options.ghostClickTimeout);
}
target.dispatchEvent(ev);我用的是第1中方法,在每个点击的fn中都加入时间判断代码,这样比较繁琐,没办法,项目经理不给修改iscroll.js,建议直接在iscroll中加时间判断。希望对你有帮助
使用了iscroll之后,内容里面的链接,默认弹出的是弹窗,在ipad上,就无法显示链接,请问这是为什么,有解决的方法吗?万分感谢!!!!