How can I bump my user back to the top of the screen?

Head out to Click on the button that says "select options." When you do that, you get a little popup in the center of the screen. Click on the "add to cart" button and a sidebar appears from the right. If you scroll up, you'll see a line of text that reads "where am I." If you click on that, the sidebar disappears.

What I need to happen is that the screen needs to jump to the top so the "where am I" text can be read without having to scroll to the top.

How can I do that?
Bruce GustPHP DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kim WalkerWeb Programmer/TechnicianCommented:
I assume you want javascript code to do this? This should work:

Open in new window

If you wanted to scroll to a specific element on the page, you should follow the hash mark with the id of the element you wish to scroll to. Without an id, the hash mark will simply take you to the top of the page.

For example, the following would scroll to the top of the div with id "sidebar_wrapper".

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bruce GustPHP DeveloperAuthor Commented:

Thanks for the feedback! I wound up using "window.scrollTo(0, 0);" and it worked great! I will keep your information handy for future endeavors, however. Thanks again for weighing in!
Bruce GustPHP DeveloperAuthor Commented:
Also, I've got another question at Would love your expertise on that one.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.