I have a page of static HTML which, on load and via jQuery, checks if a permanent cookie (“hideAnnouncements”) exists. If this cookie does NOT exist then it loads an external HTML file (containing a bullet list of announcements) into a div using jQuery’s load() method, and then executes a vertical carousel scroller on the bullet list. When the user selects to hide this div by clicking on an “x” icon, then it creates the “hideAnnouncements” cookie for subsequent visits.
The problem I’m having is that the page HTML is loaded first, and then there is a very obvious and annoying page jump when the announcements div is loaded into the very top of the page.
Without relying on server-side code (since the page is cached/static HTML), is there a better way to approach this that will avoid the page jump? Or do I just delay loading the entire page until I know if the cookie exists or not?