Send this to a friend
1
2 $('a[href*=#]').click(function() {
3
4 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
5
6 var $target = $(this.hash);
7
8 $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
9
10 if ($target.length) {
11 var targetOffset = $target.offset().top;
12 $('html,body').animate({scrollTop: targetOffset}, 1000);
13 return false;
14 }
15 }
16 });
$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body').animate({scrollTop: targetOffset}, 1000);
return false;
}
}
});