0

I am following this tutorial to create my own highlight contextual menu like medium.com. This works but on mobile devices, my custom highlight menu is hidden because the device's custom software hides it. Here is an image of the problem:

Image Of Problem

My code:

document.body.addEventListener('pointerup', function(){
   // Shows my custom highlight menu
});

So what can I do? I want to hide this highlight menu on mobile devices because it hides my custom one as shown in the image.

1 Answers1

0

Try checking this question out: Disabling the context menu on long taps on Android

An answer that worked for me was by bbsimonbb, and his answer was:

<style>
html, body { 
  -webkit-touch-callout: none !important; /* disable selection/Copy of UIWebView */
  -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */
}
</style>
<script>
window.oncontextmenu = function(event) {
     event.preventDefault();
     event.stopPropagation();
     return false;
};
</script>

If you use Jquery you can also add this to the code above:

<script>
$("body").bind('taphold', function(event) {
  event.preventDefault();
});
</script>
John Doe
  • 512
  • 1
  • 5
  • 17