很多用户希望点击以后页面跳滚动到指定到本页面的某个位置,大神用户只需复制以下JS到页面中即可。
$(document).ready(function (){
$("#点击ID").click(function (){
$(’html, body’).animate({
scrollTop: $("#目标ID").offset().top
},’ slow’);
});
});
其中 点击id为您所需点击位置的id 如 id:123 则写成$(’#123’)
目标ID为所需滚动所在的位置。
另外slow为滚动的速度可设置为 slow/normal/fast 也可设置时间如1000默认单位为毫秒。