[JavaScript]汎用スムーススクロール

汎用スムーススクロール

$('a[href^="#"]').click(function(e){
	var $this = $(this);
	var id = $this.attr('href').split('#').pop();
	var top = $('#'+id).offset().top;
	$('html,body').stop().animate({scrollTop:top},{duration:400});
	return false;
});