treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Anchor Link effect on mouse down

  • In my nav bar, I'd like to have a mousedown effect on each button. I looked for a way with JavaScript (on google) but couldn't find any that did what I wanted.
    Could somebody please post some code?

    (I would like the effect to be sort of like the Apple website)
  • you mean you want the buttons to change on hover on click and in the regular position?
  • The button changes on hover, and when active.
    I want it to change when the mouse button is pressed down. (onmousedown)
  • Well you don't need Javascript to do that...

    a:hover

    a:active

    in CSS will sort that out - you only need Javascript when you want to implement some sort of animation (without using CSS3)
  • Thanks. I'd been using divs within anchor links, but realised that I don't need the divs anymore.