The default browser event appears when moving a long press of a picture or an element, which can affect custom long-press behavior. The image and elements of the long press event effect are as follows
Found a way to get rid of
First of all to put the picture in the div background image (with a picture to try not, if there is a big God can point out), so long press when the long press is DIV
The code follows, note that jquery
//Long Press Trigger event$.fn.longlongpress =function () { vardiv = $ ( This); $( This). On ({touchstart:function(e) {Console.log (A) Timeoutevent= SetTimeout (function(){ //prevent long press the default behavior$ (div). bind (' ContextMenu ',function(e) {e.preventdefault (); }) },200); }, Touchmove:function(e) {cleartimeout (timeoutevent); Timeoutevent= 0; }, Touchend:function() {cleartimeout (timeoutevent); if(Timeoutevent! = 0) {Console.log (' This is a click, not a long press '); } return false; } }) } $(' Div '). longlongpress ();//set a background picture for a div and add a long press event
H5 Mobile Block Browser long-press event