change CSS class on clicking hyperlink

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • burtonfigg
    New Member
    • Mar 2008
    • 32

    change CSS class on clicking hyperlink

    Hi,

    On this site:
    http://www.spinxo.com/

    Names appear as links - e.g.:

    Code:
    <a href="...the link..."
    rel="nofollow" 
    target="blank">Zesticleum</a>
    If I click a link, the white star changes to orange.

    If I inspect a clicked link with FireBug, the HTML changes to:

    Code:
    <a href="...the link..."
    rel="nofollow"
    target="blank"
    class="active">Zesticleum</a>
    I am not sure how they go about doing that, as the update is instant, it doesn't look like any ajax stuff is going on in the background, but I could be wrong.

    Any advice much appreciated

    Thanks
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    It's using the active pseudoclass to make the visual change.
    Code:
    UL.list01 A.active { background-image: url(dot04b.gif); }

    Comment

    • burtonfigg
      New Member
      • Mar 2008
      • 32

      #3
      Hi - thanks for the reply. I can see how the effect is made, it was more that I couldn't work out how the HTML of the link changed as soon as the link was clicked to include class="active"...

      Thanks for your reply though :-)

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        It's a psedoclass, it's automatically applied by the browser. There is no code to do it, it's built into the way a browser works.

        Comment

        Working...