0
다음 코드를 사용하여 내 사이트의 앵커에 대한 부드러운 스크롤을 추가합니다. 나는 끈적 끈적한 헤더 ID가이를 상쇄하기 좋아 가지고 있기 때문에 에 의해 200 픽셀오프셋이있는 부드러운 스크롤링 앵커 (jquery)
$('a[href*="#"]:not([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) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});