Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Same href’s to both highlight when hovered over one of them?

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #32942
    chrisupton
    Member

    Is there a way to have anchors with the same href’s to both highlight when hovered over one of them?

    #74711
    jamygolden
    Member

    You can with jQuery. Add this to your <headgt; section:


    A class of ‘hover’ will be added to anchor links with the same href.

    #74616
    Akuseru
    Participant

    maybe with css… Like this

    #anchorone:hover{
    background: yellow;
    }
    #anchorone:hover #anchortwo{
    background: yellow;
    }
    #74422
    noahgelman
    Participant

    @Akuseru,

    Your code would imply that he has a link inside a link.

    #74424
    chrisburton
    Participant

    @noahgelman: I believe it would imply that he has a div with an ID of anchortwo inside a div with an ID of anchorone. There is no anchor link markup.

    #74298
    noahgelman
    Participant

    @ChristopherBurton, I don’t believe so.

    The id he used is ‘achorone’ that wouldn’t imply a div, but a link. I believe he was saying when you hover ‘achorone’ then a separate link, ‘anchortwo’, should get a background. Unfortunatelly that’s not how CSS works. It only cascades. I think he was trying to reselect another link on the page.

    #74282
    Akuseru
    Participant

    Yeeeeah, you are all right… I can’t think in another easy solution right now…

    #74262
    TheDoc
    Member

    Jamy already provided the easiest solution!

    #74263
    Akuseru
    Participant

    Well the jQuery works: http://jsfiddle.net/wQnNQ/1/

    Just add a class in the links you want to do somenthing, or will apply to all links…

    #74265
    Akuseru
    Participant
    #74230
    chrisburton
    Participant

    @noahgelman: My apologies. I was just going off the CSS he posted which implied a div with an ID since an anchor tag was not specified in the markup.

    #74232
    noahgelman
    Participant

    @ChristopherBurton, no apologies needed.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘CSS’ is closed to new topics and replies.