Stop page scrolling from focus

2019-08-29 07:03发布

I just installed a script to focus at my first input field, which is toward the footer. The focus works great, but the page scrolls to the bottom after loading.

Can I still use the focus and stop the page from scrolling down to the first input field?

http://www.ubspack.com/

2条回答
我想做一个坏孩纸
2楼-- · 2019-08-29 07:17
$(function(){
     $("input").focus();
     $('html, body').animate({scrollTop:0}, 'slow'); 
});)
查看更多
成全新的幸福
3楼-- · 2019-08-29 07:29

Insert this at the end of the page:

 <script type="text/javascript">
 window.scrollTo(0, 0);
 </script>

This will again scroll the page to the top.

查看更多
登录 后发表回答