当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - Focus to a particular div on window onload

问题描述:

I have recently made a horizontal and vertical scrolling site using jquery.scrollTo

On the website, i have an enter page. Once you enter, fixed navigation appears and depending upon the links , site moves here and there. This navigation remains invisible using ('#my div').hide();

I show it once the user enter the site.

But the prob is that if u reload the site(which ppl will do in case they get their internet disconneted), it remains at the same place where it was last time.. So, i am lying at an arbit position place on every reload without the navigation buttons..

So, i am searching for some alternatives so that i can make sure that the page always starts with enter page irrespective of where he was initially...

Please help....

网友答案:

If I understood you well, this would work:

$(document).ready(function(){
   window.scrollTo(0, 0);
});

This code will take to the top of the page everytime the window loads.

Hope this helps. Cheers

分享给朋友:
您可能感兴趣的文章:
随机阅读: