a:active...why doesn't it work!!!!

Discussion in 'JavaScript' started by Hades, Dec 22, 2007.

  1. #1
    Hi,

    I have a piece of code for a collapsable menu that i am using, and the problem is that I want the link that I click on, when I am on that page, to be bold. I tried implementing that in CSS, but all it does is become bold when the i press on the link. Here is the css that I am using for that part:

    .arrow {
    	display:inline;
    	float:left;
    	background:url(images/arrow.gif) no-repeat;
    	width:8px;
    	height:9px;
    	margin-top:7px;
    	margin-left: 5px;
    	}
    	
    .menutitle{
    	cursor:pointer;
    	margin:4px auto 0 auto;
    	background-color:#f73433;
    	color:#fff;
    	width:184px;
    	padding:3px;
    	text-align:center;
    	font-weight:bold;
    	}
    
    .menutitle a {
    	color:#fff;
    	}
    	
    .submenu {
    	width:190px;
    	background-color:#ffffcd;
    	list-style:none;
    	margin: 0 auto 0 auto;
    	}
    	
    
    
    .submenu a {
    	float:left;
    	margin: 3px 0 0 9px;
    	font-size:11px;
    	color:#000000;
    	text-decoration:none;
    	}
    
    .submenu a:active {
    	font-weight:bold;
    	}
    Code (markup):
     
    Hades, Dec 22, 2007 IP
  2. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #2
    Maybe you're looking for :visited?
     
    soulscratch, Dec 22, 2007 IP
  3. monosulpa

    monosulpa Guest

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if i understood what you want you just have to change .submenu a:active by .submenu a:visited i'm not very sure about if this is what you want
     
    monosulpa, Dec 22, 2007 IP
  4. Hades

    Hades Well-Known Member

    Messages:
    1,873
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    150
    #4
    Well, visited wouldn't work, because then if I visit Link 1, it will be bold, but then if I don't like whats on Link 1's page, I will visit Link 2, but Link 1 will still be bold, and now Link 2 will also be bold. What I want is only one bold link at any given time.
     
    Hades, Dec 22, 2007 IP
  5. monosulpa

    monosulpa Guest

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    man the only way that i see posible to do that is with an image or javascript
     
    monosulpa, Dec 22, 2007 IP
  6. Hades

    Hades Well-Known Member

    Messages:
    1,873
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    150
    #6
    know any JS or how to implement it?
     
    Hades, Dec 22, 2007 IP
  7. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ah wait I think I know what you mean...
    You want whatever the current link is to be bold-- just because the person is on that page? If I understand you correctly, you can have a "current" class in your html-- assuming your page is static-written, you move the "current" class on each page's html to the correct label. If the page is dynamic, then many people have a different body id instead.
     
    Stomme poes, Dec 24, 2007 IP
  8. Hades

    Hades Well-Known Member

    Messages:
    1,873
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    150
    #8
    static as in www.site.com/page.html ?

    If that's what you mean, then yes. It's static. So how would i do that?

    I have a site that has current in the navigation, but it doesn't work. It always highlights the home page. (www.gatedisguise.com)
     
    Hades, Dec 24, 2007 IP
  9. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #9
    Ok, I know what you mean.

    I'll go look for that code, I have it somewhere.

    PS: Might want to change your sig, asking for rep will get you banned.

    
    #submenu {
    	width:190px;
    	background-color:#ffffcd;
    	list-style:none;
    	margin: 0 auto 0 auto;
    	}
    	
    
    
    #submenu a {
    	float:left;
    	margin: 3px 0 0 9px;
    	font-size:11px;
    	color:#000000;
    	text-decoration:none;
    	}
    
    #submenu .active a {
    	font-weight:bold;
    	}
    
    
    Code (markup):
    Try that!
     
    tushardhoot1, Dec 24, 2007 IP
    Hades likes this.
  10. monosulpa

    monosulpa Guest

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    hey man tell me if this is what your looking for

    http://vertrigo.byethost13.com/digital/index.html
     
    monosulpa, Dec 24, 2007 IP
    Hades likes this.
  11. Hades

    Hades Well-Known Member

    Messages:
    1,873
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    150
    #11
    Thanks, that worked well. I only changed .active a to a.active,and it worked flawlessly (once i figured out exactly how it worked)

    For a second i was like, "wait, how did i end up on my site" and then i figured out what you were doing. Thanks, that's exactly right. I'll fix that when I get a chance to. What im doing now is a project i have to get finished, so I was just using my site as an example.

    Thanks
    +REP to both of you.
     
    Hades, Dec 24, 2007 IP