Disable Hold Box on ie11 W8.1 Touch Device

被刻印的时光 ゝ 提交于 2019-12-12 01:38:52

问题


When using my Windows Touch Device, holding down on an area results in a an expanding box appearing which extends to about two centimetres squared. Letting go will then result in the right click menu appearing.

The problem is that I want to disable the box and the menu from appearing.

I have managed to prevent the context menu from appearing, but I am still left with the box. I believe the box is interfering with other functionality I have on the page.

Any help much appreciated, Thanks

UPDATE

From reading the following (see section context menus):

http://msdn.microsoft.com/en-us/library/ie/jj583807(v=vs.85).aspx

it appears that I am looking to disable the "hold visual" box.

UPDATE

I have tried to intercept the MSGestureHold event in order to override it, but it does not seem be getting picked up:

      if (window.PointerEvent) {
          // elm.addEventListener("pointerdown", touchstart, false);
          elm.addEventListener("MSGestureHold", touchhold, false);
          alert('pointerdown');
      } else if (window.MSPointerEvent) {
          // elm.addEventListener("MSPointerDown", touchstart, false);
          alert('MSPointerDown');
      } else {
          //elm.addEventListener("mousedown", touchstart, false);
          alert('mousedown');
      }

I know that in ie11, the MS part of the events has been removed (eg pointerdown above), but gesturehold does not get picked up either. In fact, MSGestureHold does not appear to have been in listed in ie11's Pointer Event Updates page...


回答1:


The event you are looking for is "MSHoldVisual"

Try this:

window.addEventListener("MSHoldVisual", function(e) { e.preventDefault(); }, false);

http://msdn.microsoft.com/en-us/library/ie/jj583807(v=vs.85).aspx



来源:https://stackoverflow.com/questions/23886014/disable-hold-box-on-ie11-w8-1-touch-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!