SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Location
    Taiwan
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Opacity doesn't work on images which were dynamically loaded in IE6

    The following code adjusts the opacity of an image which were dynamically loaded. It works on all browsers except for IE6.

    However, jQuery did apply inline styles "FILTER: alpha(opacity=30); ZOOM: 1" on the image. It just doesn't work.

    Is there a workaround?

    (Attached zip is the HTML page of the following code)

    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
        <script type="text/javascript">
     
            $(document).ready(function() {
     
                $('<img />')
                .attr({ src: "http://www.sitepoint.com/wp-content/themes/thesis/custom/images/logo.png" })
                .css({ opacity: 0.3 })
                .appendTo('body')
     
            });
     
        </script>
    </head>
    <body>
    </body>
    </html>
    Attached Files Attached Files

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by IanYang View Post
    The following code adjusts the opacity of an image which were dynamically loaded. It works on all browsers except for IE6.
    It might be possible on IE6 with workarounds such as: http://docs.jquery.com/Tutorials:PNG...ty_Fix_for_IE6

    Keep in mind though that IE6 is now over 10 years old, and it officially died last year, with a funeral and everything. http://ie6funeral.com/
    Attempts to keep IE6 alive now border on the necrophiliac.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Location
    Taiwan
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    It might be possible on IE6 with workarounds such as: http://docs.jquery.com/Tutorials:PNG...ty_Fix_for_IE6

    Keep in mind though that IE6 is now over 10 years old, and it officially died last year, with a funeral and everything. http://ie6funeral.com/
    Attempts to keep IE6 alive now border on the necrophiliac.
    Thanks. The image being loaded is not always PNG. It can be JPG, so PNG-fix is not enough. And I did try IE filter alpha image load, it doesn't work.

    With regard to the IE6 market share, I know the stats are fine in North America, Europe, and Oceania. However, I sometimes have to code for Chinese websites. The stats of IE6 are okay in Taiwan and Hong Kong, but it's unacceptable in China. Therefore abandoning IE6 is not a good idea for Chinese websites currently.


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
  •