|
Posted by cwdjrxyz on 01/21/08 20:48
On Jan 21, 11:31 am, "mrcakey" <nos...@spamispoo.com> wrote:
> 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:
>
> http://mrcakey.co.uk/jones2/
>
> +mrcakey
> function menufun(x)
> {
> var fun = new Array();
> var i = 0;
> fun[0] = document.getElementById('home');
> fun[1] = document.getElementById('gallery');
> fun[2] = document.getElementById('treatments');
> fun[3] = document.getElementById('testimonials');
> fun[4] = document.getElementById('fees');
> fun[5] = document.getElementById('contact');
>
> for (i in fun)
> {
> var elem = fun[i];
> if ( i == x )
> elem.ClassName = 'current';
> else
> elem.ClassName = '';
> }
>
> }
If you do not get an answer here to your liking, you might try the
Usenet group comp.language.javascript. From the code you give, I am
not for sure what you are doing. A very direct way to do this sort of
thing would be to place both the normal image and a desaturated
version of the same image(made with some image processing tool) in the
same location using absolute positioning. Then script might be used to
switch from one image to the other on hovering over the image, using
visibility. I have never done this, but it seems likely that such a
script could be made to work. I do not have time at the moment to
experiment with this approach.
Navigation:
[Reply to this message]
|