I'm working on a responsive website that has a clickable drop down menu for mobile size screens. It works on small laptop screens on a mouse click but I'm having trouble figuring out how to have it react in the same way to a touch for mobile. Either plain Javascript or Jquery methods welcome. The class to_nav is the button that should reveal the menu.
$(window).ready(function() {
$(window).on('resize', function(){
var win = $(this);
if (win.width() >= 600) { document.getElementById('menu').style.display='inline'; }
});
});
displaynav= function () {
var nav = document.getElementById("menu");
if (nav.style.display == 'none'){
nav.style.display = "block";
}
else { nav.style.display = 'none';}
}
$(document).on("ready",function(){
$('.to_nav').click(function(){
displaynav();
})
});