1

jquery mobile provide a option of doubletap , however, when I use Ipad to test, it only do the default behavior which is zooming the page, is there any way to fix it? Thanks

  $("#book div img").live('doubletap', function() {
            $("#book").turn("disable", true); 
            var path = this.src;
            path = path.replace("medium", "original");
            var imgPath = path.replace("medium", "image");
            path = path.replace("jpg", "png");
            var textPath = path.replace("medium", "text");
            //$("body").prepend("<div id = 'view'><div id = 'popup'><img id = 'largeText' src = '' /><img id = 'largeImg' src = '' /></div></div><img id = 'close' src = 'img/close.png' /><div id='slider' style='display:none;position:fixed;z-index:105;height:25%;right: 2%;top:25%;'></div>"); 
            $("body").prepend("<div id = 'view'><div id = 'popup'><img id = 'largeText' src = '' /><img id = 'largeImg' src = '' /></div></div><img id = 'close' src = 'img/close.png' /><img id = '1x' src ='img/1x.png' class = 'icon' style='top:280px;'><img id = '2x' src ='img/2x.png' class = 'icon' style='top:340px;'><img id = '4x' src ='img/4x.png' class = 'icon' style='top:400px;'></div>"); 
            //$(".nav_arrow").css("visibility","hidden");
            $("footer").css("visibility","hidden");

            $("#largeText").attr("src",textPath);
            $("#largeImg").attr("src",imgPath);

            $("#view").css("height",$(window).height());
            $("#view").css("width",$(window).width());

            $("#popup").css("height",$("#largeImg").height());
            $("#popup").css("width",$("#largeImg").width());

            element = $('#view').viewport();
            content = element.viewport('content');
            content.draggable({
                containment: 'parent'
            });
            content.scraggable({
                containment: 'parent',
                sensitivity:'40'
            });

            $( "#view" ).show();
            $( "#popup" ).show();
            $( "#close" ).delay(500).show(0);
            $( ".icon" ).delay(500).show(0);
            $( ".icon" ).fadeTo("slow", 0.43); 
        }); 
user782104
  • 13,233
  • 55
  • 172
  • 312

1 Answers1

4

This problem can be fix-ed but you will need to lose a part of iOS web functionality.

To enable double tapping you need to disable a page scaling:

You also need to take care that mata tag from top example is used only on a iOS device, because those properties can cause problems on other devices, more about it can be found here : https://stackoverflow.com/a/12270403/1848600

By disabling page scaling you are disabling page zoom on iOS device.

Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130