amitabhaghosh197
10/21/2014 - 1:24 PM

Javascript Scroll to next page section

Javascript Scroll to next page section

/**
	 * Scroll to a section on the page.
	 */
	$('.scroll a, a.scroll').click(function(e){
	
		var rel 			= $(this).attr('rel');
		var destination 	= rel.split('_')[0];
		var window_width 	= $(window).width();
		var the_offset 		= 120;
		
		$('body , html').animate({ scrollTop: $('#' + destination).offset().top-the_offset } , 2000 , 'easeInOutCirc' );
	
		e.preventDefault();
	
	});
<a href="#testimonial-01" class="go-down scroll" rel="testimonial-01_link"><i class="fa fa-angle-down"></i></a>

rel="testimonial-01_link" <-- is the next div testimonial-01 id