Topic: a:active or "How to let users know where they are" |
|
---|---|
Author | Thread |
Maniac (V) Inmate From: there...no..there..... |
posted 01-28-2006 23:43
Just thought I'd share this with everyone. I wanted to make the links on a site I did, show something different according to which page the user was viewing. There is the a:active but it works kind of clunky with different browsers. So here is what I did. code: switch ($_GET['link']){ /*for the about page*/ case 'about': $page="pages/aboutus.php"; $title="About Us"; break; case 'contact': $page="pages/contactus.php"; $title="Contact Us"; break; default: $page = "pages/digital.php"; $title = "Home"; }
code: switch ($_GET['link']){ case 'about': $page="pages/aboutus.php"; $title="About Us"; $bodyLink="about"; break; case 'contact': $page="pages/contactus.php"; $title="Contact Us"; $bodyLink="contact"; break; default: $page = "pages/digital.php"; $title = "Home"; $bodyLink="home"; }
code: <body class=" <? echo $bodyLink ?> " >
code: <div id="leftMenu"> <ul> <li><a accessky="1" class="l1" href="/about/">About Us</a></li> <li><a accessky="2" class="l2" href="/contact/">Contact Us</a></li> </ul> </div>
code: body.about #leftMenu a.l1, body.contact #leftMenu a.l2{ background-image:url(../imgs/active.jpg); color:#fff; }
|
Paranoid (IV) Inmate From: Norway |
posted 01-29-2006 00:17
quote: A link has the :active pseudo class while it's loading, not if it points to the current URL |
Maniac (V) Mad Librarian From: the space between us |
posted 01-29-2006 09:51
nice trick, dude |
Paranoid (IV) Inmate From: Norway |
posted 01-29-2006 12:09
Check SuperfluousBanter: Navigation Matrix Reloaded. Basically it does the same thing as you, but he uses a single image for the whole navigation thus being even more cache friendly. |
Maniac (V) Inmate From: there...no..there..... |
posted 01-29-2006 16:02
quote:
|