Specifically, I have a div that I want to be perfectly centered in the middle of the user's browser on load. It would have to be centered both on the y axis and x axis (for specific reasons my page is extra tall and extra extra wide).
To be clear, I don't want to change this div's actual position on the page. I want to make it so that the browser window's scrollbars are set so that this div is in the center of the window once the page loads. (Kind of like linking to an anchor tag except I want it to load completely centered instead of top-left.)
If anyone knows of a way to do this or can provide any other input it would be greatly appreciated.
Sure, there are properties belonging to the window and the div that you can take a look at, do a little math and change to the correct values. Things to look into would be element.scrollTop (and …scrollLeft) to manipulate the scrollbars, element.offsetTop (and …offsetLeft) to help with finding the top-left corner of your div, element.offsetWidth (and offsetHeight).