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

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

问题描述

我正在使用 iScroll4 ,它运行良好!

I am using iScroll4 and it's working great!

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

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;
}

问题是它不会让< a> < input> 或任何要点击的内容(或专注,我不确定);还有css:hover或:不会应用焦点;但它会在javascript中触发事件,如

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 possible?

推荐答案

作者评论说表单兼容性很糟糕 - 这是一个已知问题,他正在为下一个版本修复。其他人在论坛中发表评论:

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:


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

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).

链接应该没问题并且可以在提供的演示中使用。您已经在init脚本中注释掉了 e.preventDefault()调用,这是通常的罪魁祸首。也许表单兼容性问题也会影响链接?

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天全站免登陆