How to bind both Mousedown and Touchstart, but not respond to both? Android, JQuery

后端 未结 9 846
无人及你
无人及你 2020-12-04 14:24

Working on a website that is also viewable on mobile and need to bind an action on both touchstart and mousedown.

Looks like this

 $(\"#roll\").bind         


        
9条回答
  •  一生所求
    2020-12-04 15:07

    Wow, so many answers in this and the related question, but non of them worked for me (Chrome, mobil responsive, mousedown + touchstart). But this:

    (e) => {
      if(typeof(window.ontouchstart) != 'undefined' && e.type == 'mousedown') return;
    
      // do anything...
    }
    

提交回复
热议问题