0

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.

zmuci
  • 518
  • 1
  • 5
  • 21
  • Here is the ff/chrome screenshot: http://i.imgur.com/UUAHTxj.png website: http://nikoladragan.com/InfinityAstrologicalMagazine/ jsFiddle: http://jsfiddle.net/tmqLmxab/ – zmuci May 16 '15 at 11:32

1 Answers1

2

Use jquery or put your code into a window.onload method. That will most probable help it. Please let me know.

K3V
  • 282
  • 6
  • 17
  • 1
    I found a solution with removing the custom font, but when I used `window.onload` it worked with any font. Thank you very much. – zmuci May 16 '15 at 12:46
  • Glad to be of help. Your offset method was causing the trouble as it returns different values on different browsers. – K3V May 16 '15 at 12:53