I'm using list items for a dropdown menu, originally with :hover
. Works well with mouseovers on desktop, but not touchscreen taps. First implemented advice to simulate the hover state with JavaScript here (referred by @z0r):
$('body').bind('touchstart', function() {});
Then, all :hover
selectors were duplicated as :active
, eg:
ul.Menu li:hover>ul,
ul.Menu li:active>ul {display:block;}
Although the submenu displays on iPhones (Safari) with a menu tap, it can't be selected: the submenu disappears. Here's a fiddle: http://jsfiddle.net/7jfo9x8h/2.
I'm not sure if the problem is browser/OS specific, but I think it works on Android/Chrome. Any solutions need to be tested on iPhone (I do not own one). Thanks in advance!
Second Q: I used cursor:pointer
within css to show the box around MENU is clickable [thanks @DOC ASAREL, great tip]. But with html below and css shown in fiddle (updated code: http://jsfiddle.net/7jfo9x8h/9), only the text is clickable/hoverable. What css mods are needed to make the full box active (click & hover)? Many thanks.
<ul class="Menu">
<li>MENU
<ul>
<li><a href="...