Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TouchEvent not working in firefox and other website browser

I have a problem, in chrome it runs well, but it won't fire in firefox

function normalizeEvent(e){     
  if(e.originalEvent instanceof TouchList){
    do somethings    
   }
}

and here is message error: ReferenceError: TouchEvent is not defined

if(e.originalEvent instanceof TouchEvent){}
like image 264
Le Toan Avatar asked Dec 05 '14 10:12

Le Toan


1 Answers

To get this work in FF, just add window.TouchEvent condition (is it defined):

if(window.TouchEvent && e.originalEvent instanceof TouchEvent){}

like image 166
driver_by Avatar answered Oct 15 '22 03:10

driver_by