jquery 页面滚动到指定位置

var position = $(".element").offset();
position.top = position.top-60;
$("html,body").animate({scrollTop:position.top}, 100);

首先获取某元素的位置

第二部 top 就是元素在纵轴的位置 可以自己进行调整 这里选择元素位置向上60px  就是-60

第三步滚动到指定位置 第二个参数为滚动时间 单位毫秒

原文地址:https://www.cnblogs.com/zwsblogs/p/12787706.html