Simon Lobo-Morell
Simon Lobo-Morell

Reputation: 29

Why might my page suddenly jump (scroll) halfway after page load?

For some reason, on the home page of my Drupal 7 website, it suddenly jumps halfway down the page, I assume, once the page is ready. FYI there is no anchor called in the URL...

Anyway I can determine what is causing this? A way of intercepting the scroll method for example?

Many thanks

Upvotes: 0

Views: 1626

Answers (1)

Toni Leigh
Toni Leigh

Reputation: 4971

Two possibles:

scrollTo()

If you trigger js that contains scrollTo('some-selector') then the page will scroll to that position

focus

If you have an input on the page that is set to be focused on load, perhaps <input type='text' name='some-input' autofocus /> then the page load with that input within the viewport

Upvotes: 2

Related Questions