Smooth Scroll Wordpress Plugin
<?php
/**
* Plugin Name: Smooth Scroll
* Plugin URI: http://
* Description: Smooth scroll for anchor links
* Version: 1.0.0
* Author:
* Author URI: http://
* License: GPL2
*/
add_action('wp_footer','smoothscroll');
function smoothscroll() {
print("<script>jQuery(function() {
jQuery.easing.myEasing = function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -12 * t/d) + 1) + b;
}
jQuery('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = jQuery(this.hash);
target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
if (target.length) {
jQuery('html,body').animate({
scrollTop: target.offset().top
}, 1000,'myEasing');
return false;
}
}
});
});</script>");
}