Jump to content

Removing colors from image?


ryeman98

Recommended Posts

I was wondering if this could even be done in Javascript and I'm not sure how to go about it. I want to display navigation using images (logos) and I want it to work like this:

 

There are multiple logos in a row, all with color. The user hovers their cursor over one of the logos and as soon as they hover, the logo goes colorless.

 

Thanks in advance,

Rye

Link to comment
Share on other sites

Javascript can't change the images, for this you need to make 2 images for each (colored and gray scale) when the mouse is over the image, swich the source to the grayscale and when the mouse is out use the color version.

 

Also, you can make them as links with a style sheet that change the background colors when the mouse is over the image.

Link to comment
Share on other sites

use this code instead of the code above(added '()' after 'gray'). this  works in ie, but not ff

<img src="image.gif" width="88" height="31" style="filter:gray()">

http://www.xentrik.net/css/filters.php

<img id="myimage" src="image.gif" width="88" height="31">
<script>
    // turn on
    document.getElementById('myimage').style.filter = 'gray()';
    // turn off
    document.getElementById('myimage').style.filter = '';
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.