When doing WebApp, iOS has a default double-click event, which will zoom the page and center the current click to the screen, it is nothing, but when the page has fixed positioning elements, then you will magically find that the fixed element can not be obtained!
What's more, the page will move up ...
//fix iOS Double-click Page UP Problem//testing in the project is not tight Input/button These form controls have this problem, p,div and so on have problems, and then directly in the body surgery(function(){ varAgent = Navigator.userAgent.toLowerCase ();//detect if it is iOS varIlasttouch =NULL;//cache The time of the last tap if(Agent.indexof (' iphone ') >= 0 | | agent.indexof (' ipad ') >= 0) {Document.body.addEventListener (' Touchend ',function(event) {varInow =NewDate (). GetTime (); Ilasttouch= Ilasttouch | | Inow + 1/** Ilasttouch is set to the current time for the first time +1*/ ; varDelta = inow-Ilasttouch; if(Delta < && Delta > 0) {event.preventdefault (); return false; } Ilasttouch=Inow; }, false); }})();//The following is a solution given by foreign coder
Http://appcropolis.com/blog/howto/implementing-doubletap-on-iphones-and-ipads
(function($){ //determine if we on IPhone or IPad varIsios =false; varAgent =navigator.userAgent.toLowerCase (); if(Agent.indexof (' iphone ') >= 0 | | agent.indexof (' ipad ') >= 0) {Isios=true; } $.fn.doubletap=function(Ondoubletapcallback, ontapcallback, delay) {varEventName, Action; Delay= Delay = =NULL? 500: Delay; EventName= Isios = =true? ' Touchend ': ' Click '; $( This). Bind (EventName,function(event) {varnow =NewDate (). GetTime (); varLasttouch = $ ( This). Data (' Lasttouch ') | | Now + 1/** The first time this would make delta a negative number*/; varDelta = Now-Lasttouch; Cleartimeout (action); if(delta<500 && delta>0){ if(Ondoubletapcallback! =NULL&&typeofOndoubletapcallback = = ' function ') {Ondoubletapcallback (event); } }Else{ $( This). Data (' Lasttouch ', now); Action= SetTimeout (function(evt) {if(Ontapcallback! =NULL&&typeofOntapcallback = = ' function ') {ontapcallback (evt); } cleartimeout (action); //Clear the timeout}, delay, [event]); } $( This). Data (' Lasttouch ', now); }); };}) (Zepto);//Usage:$ (selector). Doubletap (/** Doubletap-dblclick Callback*/ function(Event) {alert (' Double-tap '); }, /** Touch-click Callback (Touch)*/ function(Event) {alert (' Single-tap '); }, /** Doubletap-dblclick Delay (default is MS)*/400);//The following is a solution given by foreign coder--end//troubleshoot iOS double-click on the mesh move problem--end
Fix iOS Double-click Page UP problem