I'm using fadeIn and fadeOut in jQuery and it works fine on desktop. However, on mobile devices (I've only tested on iPhones though), the child div opens on touch but won't hide after touching an outside element. I'm fairly new to jQuery so I'm not quite sure what kind of solution I could implement here. Perhaps mobile detection and execute touch to open/hide, although I have no idea how I can do this. Here's my JSFiddle:
https://jsfiddle.net/9LL3mmzt/
jQuery:
$(document).ready(function() {
$(".parent").hover(function() {
$(this).children(".child").fadeIn("fast");
}, function() {
$(this).children(".child").fadeOut("fast");
});
});
HTML:
<div class="parent">
<span>Peek-A-</span>
<div class="child">
<span>Boo</span>
</div>
</div>
CSS:
.child {
display: none;
}
I tried the first solution from this thread: time-out on jQuery hover function
However, I could not make it work correctly due to my limited knowledge.