I have a responsive dropdown menu that only opens on touch or click then closes when clicking or touching anywhere outside the menu. problem occurs if mobile user simply wants to swipe further down the page, as soon as they touch to scroll, the menu closes. I want it to close only when touching outside the menu and not when scrolling (touchmove).
this is the js i have currently which closes the menu on any kind of touch event even if just trying to slide the screen. I don't want this function to occur if someone tries to scroll via touch:
$('html').bind('touchstart', function(e) {
$('.topMenu').removeClass('expand');
$('.topMenu').find('ul.submenu').removeClass('expand');
var newValue = $(this).find('span.indicator').text() == '+' ? '-' : '+';
$(this).find('span.indicator').text(newValue);