I created a custom Navbar which is working perfectly. My problem lies within which functionality to use based on the device in action. For touchscreen devices I would like to use the click function, and for keyboard devices hover. I have two scripts both for hover and click events for my Navbar.
Click
<script>
$( '.tc-navigation > li' ).click(function() {
$(this).children('ul').toggleClass('toto');
$(this).siblings().children('ul').removeClass('toto');
return false;
});
$(document).click(function() {
$('.tc-navigation > li > ul').removeClass('toto');
});
</script>
For Hover
<script>
$( '.tc-navigation > li' ).hover(function() {
$(this).children('ul').toggleClass('toto');
});
</script>
Can anybody please assist how I can figure out the type of device used as well as how to implement the already written scripts at hand?