jqueryを使ってページ内リンクのスムーススクロール
以下参考サイト。
// jquery.easing プラグインより抜粋。animate()に指定する。 jQuery.easing.outquart = function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }; $(document).ready(function() { $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var t = $(this.hash); t = t.length && t || $('[name=' + this.hash.slice(1) +']'); if (t.length) { var targetOffset = t.offset().top; $('html,body').animate({scrollTop: targetOffset}, 1200, 'outquart'); return false; } } }); });