sandervanloock / HTMobieL

Thesis repos voor htmobiel.wordpress.com
2 stars 1 forks source link

tap event triggered twice on iOS 6.0.1 (only iPad) #11

Closed miteyema closed 11 years ago

miteyema commented 11 years ago
<!DOCTYPE html>
<html>
<head>
    <title>Double tap event problem</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css"/>
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
    <script>
        $(document).on("tap", "#one-button", function () {
            $.mobile.changePage("#two");
        });
        $(document).on("tap", "#two-button", function () {
            $.mobile.changePage("#one");
        });
    </script>
</head>
<body>

<div data-role="page" id="one">
    <a href="#" data-role="button" id="one-button">Go to two</a>
</div>

<div data-role="page" id="two">
    <a href="#" data-role="button" id="two-button">Go to one</a>
</div>

</body>
</html>
miteyema commented 11 years ago

Bug is explained on jQM docs site: http://view.jquerymobile.com/master/docs/faq/how-do-i-use-touch-mouse-events.php Safest is to use a click event, but then a 300-500ms delay is introduced.