iScroll不会让项目被点击 [英] iScroll wont let items be clicked

查看:107
本文介绍了iScroll不会让项目被点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 iScroll4 ,效果非常好!



是我用来初始化,刷新和结束iScroll的函数:

  function iniciarIscroll(){
/ * En ie7没有lo usamos * /
if(!ie7){
$(document).ready(function(){
myScroll1 = new iScroll('nvl1');
myScroll2 =新的iScroll('nvl2');
/*document.addEventListener('touchmove',function(e){e.preventDefault();},false);
document.addEventListener('DOMContentLoaded' setTimeout(function(){loaded();},200),false); * /
});
}
return false;
}

function refrescarIscroll(){
if(!ie7){
myScroll1.refresh();
myScroll2.refresh();
}
return false;
}


函数terminarIscroll(){
if(!ie7){
myScroll1.destroy();
myScroll1 = null;
myScroll2.destroy();
myScroll2 = null;
}
return false;
}

问题是不会让 a> < input> 或任何要点击(或重点,我不确定);还有css:hover或:focus不会被应用;但它会在JavaScript中触发事件,如

  .hover()或.click()
解决方案

任何想法如何解决这个问题? >

作者评论说,表单兼容性是微不足道的 - 这是一个已知的问题,他正在为下一个版本的修复。有人在论坛中发表了评论:


截至v4.1.9,对表单字段的支持仍在开发中。你
可以通过包装在标签
中使单选按钮和复选框工作(包装似乎比使用for =语法更好)。


链接应该很好,并在提供的演示中工作。您已经注释掉了在您的init脚本中的 e.preventDefault()调用,这是通常的罪魁祸首。也许窗体兼容性问题也影响链接?



对于悬停事件,从我可以告诉这应该在元素被点击时激活。



希望有所帮助。最糟糕的情况 - 删除代码,从项目的演示页开始,适应您的需要一次一行,并继续测试。您很快就会知道哪些修改会中断预期的行为。


I am using iScroll4 and it's working great!

This are the functions I use to init, refresh and end iScroll:

function iniciarIscroll(){
    /*En ie7 no lo usamos*/
    if(!ie7){
        $(document).ready(function() {
            myScroll1 = new iScroll('nvl1');
            myScroll2 =new iScroll('nvl2');
            /*document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
            document.addEventListener('DOMContentLoaded', setTimeout(function () { loaded(); }, 200), false);*/
        });
    }
    return false;
}

function refrescarIscroll(){
    if(!ie7){
        myScroll1.refresh();
        myScroll2.refresh();
    }
    return false;
}


function terminarIscroll(){
    if(!ie7){
        myScroll1.destroy();
        myScroll1 = null;
        myScroll2.destroy();
        myScroll2 = null;
    }
    return false;
}

The problem is it won't let <a> or <input> or anything to be clicked (or focused, I am not sure); also css :hover or :focus won't be applied; but it would fire events in javascript like

.hover() or .click()

Any idea how to solve this if posible?

解决方案

The author has commented that form compatibility is glitchy - it's a known issue and he's working on a fix for the next version. Someone else has commented in the forums:

As of v4.1.9, support for form fields is still under development. You can make radio buttons and checkboxes work by wrapping in a label (wrapping seems to work better possibly than using for="" syntax).

Links should be fine and work in the demos provided. You've commented out the e.preventDefault() call in your init script which is the usual culprit. Maybe the form compatibility issue is affecting links also?

As for the hover event, from what I can tell this should be activated when an element is tapped.

Hope that helps a little. Worst case scenario - scrap your code and start with a demo page from the project, adapt to your needs one line at a time and keep testing it. You'll soon know which modification breaks the intended behaviour.

这篇关于iScroll不会让项目被点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆