SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    443
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Change opacity of image in Safari and Opera

    Is there a cross browser way to change the opacity of an image? I have found a way that works for IE and Firefox but would like it to work in Safari and Opera as well.

    Thanks.

  2. #2
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    443
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It's okay, I figured it out.

    Thanks.

    Code:
    		function changeopacity( opacity, id ) {
    		
    			var object = document.getElementById( id ).style;
    			object.opacity = ( opacity / 100 );
    			object.MozOpacity = ( opacity / 100 );
    			object.KhtmlOpacity = ( opacity / 100 );
    			object.filter = "alpha(opacity=" + opacity + ")";
    		
    		}


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
  •