|
Posted by Adrienne Boswell on 01/21/08 20:59
Gazing into my crystal ball I observed "mrcakey" <nospam@spamispoo.com>
writing in news:fn2ktt$c86$1@aioe.org:
> Is it even possible to do this the way I'm trying to? I've got a menu
> where the background images change from desaturated to coloured on
> hover and when selected (all through CSS).
>
> As a "nice to have", I'd like to make it so that when the user is
> hovering over an image, the "selected" image is desaturated, i.e. only
> image at a time is coloured. This is how far I've got, but I'm a bit
> of a JavaScript noob and I'm not even sure what I'm trying to do is
> possible
I don't think you need javascript for this. You can do it server side
with CSS. You need a few things, but they are simple.
At the top of the each page, before anything else:
<?php $thispage = "index.php"; //or whatever the URI actually is?>
In your navigation:
<li><?php nav("index.php","Home",$thispage)?></li>
The function:
//for navigation
function nav($link,$page,$thisurl)
{
if($thisurl == $link)
{
echo "<a href=\"".$link."\" class=\"thispage\">".$page."</a>";
}
else
{
echo "<a href=\"".$link."\">".$page."</a>";
}
}
CSS:
a.thispage {background-image:url("desaturated.png");}
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Navigation:
[Reply to this message]
|