$(document).ready(function() {
$('a[href*=#]').bind('click', function(e) { // Apply to all links starting with #
e.preventDefault(); // Prevent default behaviour (Jumping to target)
var target = $(this).attr("href"); // Get the target
// Animate
$('html, body').stop().animate({ scrollTop: $(target).offset().top }, 1000, function() {
location.hash = target; // Attach the hash (#target) to the URL
});
return false;
});
});
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.