0

I'd like to change the font color of a JS-forward-button (history.forward()), if there is no newer site in history. Kinda like browsers forward-buttons. Is there a way to achieve this? I want to keep it simple and avoid additional libraries except for jquery.

Currently I have these two links.

.navigation {color:#000}

<a href="javascript:history.back();" class="navigation">Back</a>
<a href="javascript:history.forward();" class="navigation">Forward</a>

Now if you visit the page for the first time and click on back, you get back to whereever you came from. But if you click on forward, nothing happens, because, of course, you are already on top of the history. So I look for a way to give the forward link a {color:#666} in this case.
If the user navigated a bit on the site and clicked back at some point, he is able to go forward in history again and the link should get a {color:#000}. That is exactly what the chrome context menu, for example, does. Any chances?

Moritz Friedrich
  • 1,371
  • 20
  • 38
  • 1
    Bare in mind it really helps to see any code you've currently been working on. This will help people be able to give you an accurate answer – Gerico Aug 12 '13 at 12:08
  • Post the HTML code for your button and someone can give you an answer specific to your selector. – CaribouCode Aug 12 '13 at 12:32

0 Answers0