Login Latest Snippets Home My Account
Snippee! A personal code snippet manager... Store, share, organize! ...

Smooth scrolling

Published: 2011-11-21 14:15:06 - In: jQuery

Create a smooth sliding effect when a link with the topLink class is clicked

$("a.topLink").click(function() {
	$("html, body").animate({
		scrollTop: $($(this).attr("href")).offset().top + "px"
	}, { duration: 500, easing: "swing" });
	return false;
});