javascript - Mouseenter + Click event with only one tap on WP8.1 -
I'm trying to fix my dropdown menu for IE10 / 11 on WP8.1.
I have a drop down menu that activates the submenu on the mouseenter or onclick, plus the onclick function check, if the submenu is already visible - the redirect to the destination (the href is in the original menu).
PC: Mouse Center - I see submenu, if I click on the guardian - I was redirected.
IOS: First click on the menu - Shows submenu, second click - Redirect.
WP: Click execute both events first! MouseTenter - So it shows submenu and then onclick - so it redirects me poorly.
How can I fix this?
I tried: 1. Touch-verb: none; 2. Set a timer between 2 events, but it's big enough! 300-500 ms, so I can not always use it
This code thanks the timer, I added a check on the IEMobile browser to fix quick clicks on the PC. But this is bad, how can it be improved?
$ ('.sidesliderparent'). Click (function (e) {var path = $ (this). Child ('a'). Attr ('href'); var subid = $ (this) .attr ('data-submenu-id'); var Diff = Date.now () - Timemove overview; // Check that if submenu is displayed, var is displaced = true; if (sub id) {display} = ($ ('#' + sub ID). Css ('display') == 'Block')}} E. prevent default (); if (subid & path! = '' & Amp; amp;; path! = '#' And & amp; display and & amp; amp; amp; Amp;; diff & gt; 500 ||! Navigator.userigent.mach (/Imobile / i)) {document.location.href = path;} if (Hadisplayed = = False) {ActivateSubmenu (this);} E.Stop ImiadietApps ();});
- Activate OnMuscenter bus applet.
Take a look at the touch event.
Comments
Post a Comment