juandahveed
9/28/2017 - 1:18 PM

clickable desktop parent and clickable mobile parent

clickable desktop parent and clickable mobile parent

(function($){
	$(document).ready(function(){		
		if ( $(document).width() >= 768 ) {
			// here we set up our desktop menubar			
			// this line makes the parent level menu clickable
			$('.dropdown-toggle').click(function(e) {
			e.preventDefault();
			var location = $(this).attr('href');
			window.location.href = location;
			return false;
			});
		} else {
			// this is now the mobile version of the site
			$('button.navbar-toggle').on('click', function(){
				setTimeout(open_menu, 50);
			});
			var open_menu = function(){
				if ( !$('.navbar-toggle').hasClass('collapsed') ) {
					$('.navbar-toggle').addClass('menu_open');
						console.log('open');
				} else {
						$('.navbar-toggle').removeClass('menu_open');
						console.log('closed');
					}
			};
			// if the mobile parent is open, go to that page.
			$('.dropdown-toggle').click(function(e) {
			e.preventDefault();
				if ( $(this).parent().hasClass('open') ) {
					var location = $(this).attr('href');
					window.location.href = location;
					return false;
				} else {}
			});
		}
	});
})(jQuery);