跳转至锚点

1.当前页跳转至锚点
页面点击事件触发即可

1 //跳转至锚点
2 function scrolltoButtom(){
3     $('html,body').animate({scrollTop:$('#billList').offset().top}, 1000);
4 }

2.从其他页面跳转至另一页面后 滑动至锚点,方法一致,只需要写在js 中的
$(document).ready(function()  写在这里面就可以了。

1     var  stateSro = $('#scrollTosatae').val();
2     if(stateSro == 1){
3         $('html,body').animate({scrollTop:$('#billList').offset().top}, 1000);   //页面滚动到底部
4     }

 stateSro  的值为,前台点击时传入后台,后台再返回到另一页面,取出此属性值,判断是否需要滑动。

posted @ 2019-05-20 17:44  atimo  阅读(752)  评论(0编辑  收藏  举报