简体   繁体   English

JavaScript单击事件在iPad上不起作用

[英]Javascript click event doesn't work on iPad

I have created a website using backbone.js, jquery and pure javascript. 我创建了一个使用骨干网站.js,jquery和纯javascript的网站。 In my sidemenu I have a list with some countries. 在我的补充菜单中,我列出了一些国家/地区。 If you click a country a sublist opens with cities, And if you click on a city another list expands below it filled with museums. 如果单击一个国家,则将打开一个子列表,其中包含城市;如果单击一个城市,则另一个列表将在其下方展开,并充满博物馆。 Each museum has a checkbox next to it. 每个博物馆旁边都有一个复选框。 So when you open the list all the checkboxes are filled and all the museums are shown in my page. 因此,当您打开列表时,所有复选框均已填写,所有博物馆都显示在我的页面中。 When you close the list the checkboxes are unckecked and the list toggles up. 关闭列表时,复选框会被取消选中,列表会向上切换。 It works fine with every pc browser and with all the android devices I have checked. 它适用于每个PC浏览器以及我检查过的所有android设备。 But it doen't work on Ipad. 但这在Ipad上不起作用。 Every time I click on a city it may check or uncheck the checkboxes, toggle or not the list etc Its works pretty weird. 每次我单击一个城市时,它可能会选中或取消选中复选框,是否切换列表等等,其工作方式都很奇怪。

events: {
        "tap li.category a.check-toggle" : "toggleAllMuseums"
    },


toggleAllMuseums: function(e){.....}

html HTML

<li class="category">
    <a class="toggle check-toggle">London</a>
    <ul class="collapsible checkbox">
        <li>
            <label>
                <input type="checkbox"> London Museum
            </label>
        </li>
    </ul>
</li>

This is a sample of my code.. The problem is only in iPad.. 这是我的代码示例。问题仅在iPad中。

it's a know issue for ipad 这是ipad的已知问题

A workaround is consider the click as activating/hovering an element: http://www.danwellman.co.uk/fixing-jquery-click-events-for-the-ipad/ 一种解决方法是将点击视为激活/悬停元素: http : //www.danwellman.co.uk/fixing-jquery-click-events-for-the-ipad/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM