$('.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;
		}  
	);
});





/* -----------------------------
(function( $ ) {
	$.fn.timespent = function(options){
		var urla = "https://davidawindham.com/wik/index.php?module=API&method=UserCountry.getCity&format=json&idSite=1&period=month&date=yesterday&expanded=1&token_auth=d97e3e8f34071515ad1f6e345f6035af";
		var data = [];
		function isLoaded (recentElement) {
			for (var i = 0; i < country.length; i++){
				var markup = $("<li class='list-group-item'>" + data[i].label + " - <span class='artist'>" + data[i].nb_visits + " : " + data[i].sum_visit_length + "</li>");
				recentElement.append(markup);
			}
		}
		return this.each(function(){
			var $this = $(this);
			$.getJSON( urla, function(data){
				$(data).each(function(){
					data.push ({
						artist:	this.label,
						title: this.nb_visits,
						album: this.sum_visit_length
					});
				});
				isLoadedr($this);
			});
		});
	};
	$('.time-spent').timespent();

})( jQuery );

------ SAVE FOR LATER  -------*/