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)
<!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>