1
다음 코드를 사용하여 링크 간 원활한 이동이 가능하며 완벽하게 작동합니다.모바일에서 다른 스크롤 오프셋
현재 오프셋은 93px이지만 작은 장치에서는 제거하지 않을 경우이 값을 작게하고 싶습니다. 더 작은 해상도의 오프셋 값을 변경할 수 있는지 궁금합니다. 누구든지 도와 줄 수 있습니까?
var jump=function(e)
{
if (e){
e.preventDefault();
var target = $(this).attr("href");
}else{
var target = location.hash;
}
$('html,body').animate(
{
scrollTop: $(target).offset().top-93
},2000,function()
{
location.hash = target;
});
}
$('html, body').hide();
$(document).ready(function()
{
$('a[href^=#]').bind("click", jump);
if (location.hash){
setTimeout(function(){
$('html, body').scrollTop(0).show();
jump();
}, 0);
}else{
$('html, body').show();
}
});