Results 1 to 4 of 4

Thread: onmouseover --> images goes gray Need Fix

  1. #1
    Join Date
    Apr 2009
    Posts
    45
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default onmouseover --> images goes gray Need Fix

    Hello Friends,

    I've set the following page for example and it is working perfect on IE but
    at displaying it with FireFox it won't work

    Here is direct example link for the page

    http://zwark.info/test/x.html

    OR you can check the code here

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <title>TEST</title>
    <HEAD>
    
    
    <style>
    img
    {
    filter:gray()
    }
    </style>
    
    
    <script type="text/javascript">
    function color(elmnt)
    {
    elmnt.style.filter=false
    }
    
    function gray(elmnt)
    {
    elmnt.style.filter="gray()"
    }
    </script>
    
    </HEAD>
    <BODY>
    
    <p align="center"><img alt="" src="1.gif" onmouseover="color(this)" onmouseout="gray(this)"/></p>
    
    </BODY>
    </HTML>
    Is there any chance that it works fine with firefox

    thanks in advance
    Last edited by egturnkey; 04-30-2009 at 03:58 PM. Reason: thanks everybody for helping me

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    CSS filters only work in IE. You will need to create two images and use hover to get it to work in other browsers.

    Good luck!
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    It shouldn't be too hard to create the original image in grey, I'm sure there are functions in Photoshop or equivalents that convert images to grayscale. The only problem I foresee is if you're wanting to do this with images that are uploaded by users every 5 minutes, going through all of them and converting them will be a tad tedious.

    Generally rollovers will be hard coded in though, so converting two or three images shouldn't be too difficult.

  4. #4
    Join Date
    Apr 2009
    Posts
    45
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default

    thanks, friends for helps me, i will use hover.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •