When I load the page for the first time, I have a menu, element in the menu might have "current_page" class which I add via PHP
if the current page is the menu element. Now the problem is when I enter the page for the first time or refresh it with ctrl+f5
, which is the same, the slider that is suppose to go under the "current_page" class is slightly off. Different in Firefox and Chrome (see pictures below), but after I refresh the page with normal f5 or click on some links, so the page reloads, everything goes bask to the right and works until I hardreload the page again. I tried to make a JS fiddle but there it works every time. So I will post the link online, so you can see it there and tell me if you also have the problem.
<nav>
<div class="menu_slider"></div> <a href="index.php"><div class="navigation current_page">Home</div></a>
<a href="about_us.php"><div class="navigation">About Us</div></a>
<a href="#" target="_blank"><div class="navigation">Blog</div></a>
<a href="magazine.php"><div class="navigation">Magazine</div></a>
<a href="contact.php"><div class="navigation">Contact me</div></a>
</nav>
I have to paste some code or it won't let me post the comment.
Thank you for any help possible.
Use jquery or put your code into a
window.onload
method. That will most probable help it. Please let me know.