I have a simple webpage with a 3 section format that scrolls horizontally. I want the page to load on the middle section. I’ve found a couple of solutions on here but none of them have worked. Maybe I’m not doing them right. I’m not experienced in coding.
I know I can’t use anchor tags for the url because it’s for my main page so visitors have to put in the web address. There has to be a simple solution for this. Any help is appreciated. Thanks.
Advertisement
Answer
The middle section should look like this:
<section id="mainSection" tabindex="1"> </section>
And on windows load, the focus() function should work:
$("#mainSection").focus();//jQuery
OR
document.getElementById("mainSection").focus();//JavaScript