module.exports = {
	forceHidden: true,
	initialize: function(options) {
		this.listenTo(this.app.router, 'route', this.onRouteChange);
		this.onRouteChange(null,window.location.pathname.split("/").slice(1))
	},
	attach: function() {
		console.log("att")
		var thisView = this;
		$(window).scroll(function(e){
			console.log($('.snap-top-static').offset().top < window.pageYOffset)
			if(!thisView.forceHidden && $('.snap-top-static').offset().top < window.pageYOffset){
				thisView.$el.addClass('fixed')
				$('.snap-top-static').addClass('hidden')
			}
			else {
				thisView.$el.removeClass('fixed')
				$('.snap-top-static').removeClass('hidden')				
			}
		});
	},
	onRouteChange: function(route, params) {
		if(params[0] != 'services'){
			this.forceHidden = true;
		}else{
			this.forceHidden = false;
		}
	}
};
