I have an existing hover menu that functions well across all browsers and devices i have tested. Inside this menu, i have added a input box for login and password and now when touching the password field on the ipad/iphone using Safari, it triggers the menu to close. This behavior happens in IE(desktop) also.
To fix this in IE, I used this code:
<script type="text/javascript">
$(document).ready(function(){
$(".subnav-container select").mouseleave(function(event){
event.stopPropagation();
});
});
</script>
After adding this fix, the issue still remains in Safari on ipad/iphone. However, it works properly in Chrome on ipad/iphone.
I have tried this fix for mobile Safari, but it is not working:
<script type="text/javascript">
document.addEventListener('touchstart', function ( e ) {
e.preventDefault();
var touch = e.touches[0];
alert(touch.pageX + " - " + touch.pageY);
}, false);
</script>
I tried touchenter , touchleave , touchstart but have no experience with how to apply a fix for touchscreen device issues.
My basic html is as follows:
<div data-async-loaded="loaded" data-gadget="menu.gadget.MyMenuNav" data-load="preloaded">
<nav class="menu">
<div class="tier0">
<div class="shop facet nav-section" data-subnav="tab1" data-nav-tracking="tab1">
<a href="javascript:void(0)">
<span class="font-family--platform button-font-size--small facet-label">
LOGIN
<span class="arrow-down text--medium-light-grey">
</span>
</span>
</a>
</div>
</div>
<div class="tier1">
<div data-subnav="tab1" class="subnav tracking is-hidden" data-nav-tracking="tab1">
<div class="subnav-container">
<div class="subnav-section">
<div class="subnav-item l-w6 visual-format">
<form name="login" action="http://football21.myfantasyleague.com/2013/login" method="post">
<input type="hidden" name="LEAGUE_ID" value="24779" />
<table align="center" cellspacing="1" class="homepagemodule report" id="welcome"><caption><span>Welcome</span></caption><tbody><tr><th colspan="2">Guest</th></tr>
<tr class="oddtablerow"><td class="inputlabel">Login As:</td>
<td><select size="1" name="FRANCHISE_ID">
<option value="0000">Commissioner</option>
<option value="0001">UR4BIDN</option>
<option value="0002">NIKE TEAM B</option>
<option value="0003">NIKE TEAM C</option>
<option value="0004">Franchise 4</option>
<option value="0005">Franchise 5</option>
<option value="0006">Franchise 6</option>
<option value="0007">Franchise 7</option>
<option value="0008">Franchise 8</option>
<option value="0009">Franchise 9</option>
<option value="0010">Franchise 10</option>
<option value="0011">TRADEA</option>
<option value="0012">TRADEB</option>
</select></td></tr>
<tr class="eventablerow"><td class="inputlabel">Password:</td><td><input name="PASSWORD" type="password" size="10" /> </td></tr>
<tr class="oddtablerow"><td align="center" colspan="2"><input type="submit" value="Login" /> </td></tr>
</tbody></table></form>
</div>
</div>
</div>
</div>
</div>
</nav>
</div>
script type="text/javascript">
document.addEventListener('touchend', function ( e ) {
e.preventDefault();
e.stopPropagation();
var touch = e.touches[0];
alert(touch.pageX + " - " + touch.pageY);
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.