javascript - Converting 'touchstart' event to 'mousedown' event -


i got 1 request client change html package support desktop browsers. package developed support ipads. package developed full of 'touchstart' event. want convert touchstart mousedown or touchstart mousedown. sample code reference. working fine in ipads. not in desktop.

 $('.toggle-button').bind("touchstart",function() {    alert("toggle button tapped");  }); 

i sure find , replace take more time , not effective one. there solution or find , replace solution. in advance.

trigger mousedown event ,inside touchstart event.

var elem = document.getelementbyid('yourdiv');  $('body').on('touchstart', '[id^="showmenu_"]', function(e){         e.preventdefault();        elem.dispatchevent(new event('mousedown'))     }); $(elem).on('mousedown', function () {     alert('on'); }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -