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
Post a Comment