javascript - On Windows Phone's IE Touchstart Event Ends Automatically After Few Seconds -


i have specific problem. i'm writing web-page mobile phones has button on it. i'm detecting touchevent on every browser including ie, on ie it's quite specific. after few seconds automatically ends. can somehow me? here code (modified one, still not working properly):

if (window.navigator.pointerenabled) {     tapbutton.addeventlistener("pointerup", function(e) {         e.preventdefault();         addclass(this, 'clicked');         buttontouched = true;     }, false);     tapbutton.addeventlistener("pointerdown", function(e) {         e.preventdefault();         removeclass(this, 'clicked');         buttontouched = false;     }, false);     alert("pointerenabled"); } else if (window.navigator.mspointerenabled) {     tapbutton.addeventlistener("mspointerdown", function(e) {         e.preventdefault();         addclass(this, 'clicked');         buttontouched = true;     }, false);     tapbutton.addeventlistener("mspointerup", function(e) {         e.preventdefault();         removeclass(this, 'clicked');         buttontouched = false;     }, false);     alert("mspointerenabled"); } else {     alert("ordinary touch");     tapbutton.addeventlistener('touchstart', function(e) {         e.preventdefault();         addclass(this, 'clicked');         buttontouched = true;     }, false);     tapbutton.addeventlistener('touchend', function(e) {         e.preventdefault();         removeclass(this, 'clicked');         buttontouched = false;     }, false); } 

and html tag has in it:

-ms-touch-action: none !important; touch-action: none !important; 

but not either.

i suspect running multi-touch issue...

remember, touch events not same mouse events. can touch more 1 finger. happens if touch 1 finger add second finger? 2 consecutive touchstart events. same true touchend. suspect user light right it's triggering finger release incorrectly...

please have @ happening touches, changedtouches , targettouches properties of touchevent in listener. suspect you'll see there still 'finger' left touching... went 2 touches 1...

making sure (no longer) touching finger 1 that's on button etc lot less simple old mouseup , mousedown events were.

edit: realize problem ie , it's pointer events... work same in support multi-touch (and suffer same issues). i'm not seeing property akin touches, see pointerid, can give same info (at cost of bookkeeping on end).

this msdn page has info. code snippet enlightening think:

function pointerdownhandler(evt) {       evt.target.setpointercapture(evt.pointerid); } 

this seems confirm that, when finger hits surface, contact point gets id, used inform finger left surface when receive pointerup event.

i'd add logging prints pointerid on pointerdown , pointerup , i'll bet find solution.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -