function addClickHandler(navButtons){
	    	navButtons.addEventListener("click", function(e){
	   			function easeInOutQuart(t, b, c, d) {
	   			// t: current time, b: begInnIng value, c: change In value, d: duration
  				if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
  				return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
				}

	    		var thisButtonName = navButtons.innerHTML;
	    		var targetPageName = navButtons.getAttribute("data-name").replace(/navButtons/gi,"page");
	    		var targetPage = document.querySelector("[data-name~="+targetPageName+"]");
	    		var currentPageTop = window.pageYOffset;
	    		var targetPageTop = targetPage.offsetTop;
	    		var start = new Date().getTime();
	    		var duration = 1500;
	    	
	    		// Scroll		
	    		var animationInt = setInterval(function(){	
	    			var time = new Date().getTime() - start;
	    			if(time>duration){
	    				time = duration;
	    			}
	    			var x = easeInOutQuart(time, currentPageTop, targetPageTop - currentPageTop, duration);
	    			window.scrollTo(0, x);	
		    		if(time>=duration){
		    			clearInterval(animationInt);
		    		}
		    	}, 30);		
		    }, false);		
	    }
//Event handler for navigation button scroll animation
Event handler for navigation button scroll animation
Event handler for navigation button scroll animation
function addClickHandler(navButtons){
	    	navButtons.addEventListener("click", function(e){
	   			function easeInOutQuart(t, b, c, d) {
  				if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
  				return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
				}
	    		var thisButtonName = navButtons.innerHTML;
	    		var targetPageName = navButtons.getAttribute("data-name").replace(/navButtons/gi,"page");
	    		var targetPage = document.querySelector("[data-name~="+targetPageName+"]");
	    		var currentPageTop = window.pageYOffset;
	    		var targetPageTop = targetPage.offsetTop;
	    		var start = new Date().getTime();
	    		var duration = 1500;
	    		var animationInt = setInterval(function(){	
	    			var time = new Date().getTime() - start;
	    			if(time>duration){
	    				time = duration;
	    			}
	    			var x = easeInOutQuart(time, currentPageTop, targetPageTop - currentPageTop, duration);
	    			window.scrollTo(0, x);	
		    		if(time>=duration){
		    			clearInterval(animationInt);
		    		}
		    	}, 30);		
		    }, false);		
	    }
function addClickHandler ( navButtons ) { navButtons . addEventListener ( "click" , function ( e ) { function easeInOutQuart ( t , b , c , d ) { if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b ; return - c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b ; } var thisButtonName = navButtons . innerHTML ; var targetPageName = navButtons . getAttribute ( "data-name" ) . replace ( / navButtons / gi , "page" ) ; var targetPage = document . querySelector ( "[data-name~=" + targetPageName + "]" ) ; var currentPageTop = window . pageYOffset ; var targetPageTop = targetPage . offsetTop ; var start = new Date ( ) . getTime ( ) ; var duration = 1500 ; var animationInt = setInterval ( function ( ) { var time = new Date ( ) . getTime ( ) - start ; if ( time > duration ) { time = duration ; } var x = easeInOutQuart ( time , currentPageTop , targetPageTop - currentPageTop , duration ) ; window . scrollTo ( 0 , x ) ; if ( time >= duration ) { clearInterval ( animationInt ) ; } } , 30 ) ; } , false ) ; }
Event handler for navigation button scroll animation
Event handler for navigation button scroll animation
// t: current time, b: begInnIng value, c: change In value, d: duration // Scroll		