简体   繁体   中英

Stop page scrolling from focus

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/

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.

$(function(){
     $("input").focus();
     $('html, body').animate({scrollTop:0}, 'slow'); 
});)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM