/*============================================
		     Navigation
==============================================*/

$('.nav-toggle').on('touchstart click', function(e) {
	e.preventDefault();
	$( this ).toggleClass( 'active' );
});

$(function dw_hidenav() {
	var headerHeight = $('.navbar').height();
	$(window).on('scroll', { previousTop: 0 },
		function() {
		var currentTop = $(window).scrollTop();
		if (currentTop < this.previousTop) {
			if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
					$('.navbar').addClass('visible');
				} else {
					$('.navbar').removeClass('visible fixed');
				}
		}
		else {
			$('.navbar').removeClass('visible');
			if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
		}
		this.previousTop = currentTop;
		}
	);
});