Reputation: 358
I have an issue with my website. My page loads normally in Firefox, but when I use either Chrome or Safari, it goes to the bottom of the page and I don't understand why. I tried putting the following snippet at the beginning of the page, but no luck.
<script>
$(document).ready(function() {
$(document).scrollTop(0);
});
</script>
Why does the page go to the bottom on loading?
Upvotes: 2
Views: 8476
Reputation: 1
I had 2 links to my home page in my footer. When I removed the links from my footer the problem went away.
Upvotes: 0
Reputation: 79
i have an alturnative work around for you and incase you ever need to get to the top of the page - you can use this javascript as an alturnative:
((IJavaScriptExecutor)webapplication).ExecuteScript("window.scrollTo(0, document.body.scrollHeight 0)");
however the other option would be to set a start up property: for example document.start("body.height = 0") something along those lines may work.
preferably id use option one as a code to start the broswer at a set height may not work so well for every browser. hope this helps.
Upvotes: 0
Reputation: 21
Try to have your image and other contents put inside div and set the box attribute of the div to margin:auto. works well with HTML5.
Upvotes: 1
Reputation: 59283
When going to your site, I get redirected to http://www.ondinevermenot.fr/#start. That means the page will try to jump to the start
element.
However, the start
element is absolutely positioned. Therefore, when the page tries to jump down, the start
element moves down with it. Therefore the page tries to jump down again. Then the start
element moves down more. They keep going down until the bottom of the page, when there is no more room.
To fix it, don't redirect to #start
when your page loads.
Because of the strangeness of jumping to something that's absolutely positioned, it's probably handled differently in different browsers.
Upvotes: 5