elsewhere home of a .NET geek

  Home  |   Contact  |   Syndication    |   Login
  21 Posts | 1 Stories | 52 Comments | 35 Trackbacks

News

This blog has random information about Managed Code and Design Pattern. Every day, while i code, the thoughts come in mind are the one you would be reading here.

If you're seeking me for asking any questions, please use the contact page of this site.

Twitter












Article Categories

Archives

Post Categories

Thursday, April 13, 2006 #

The problem that IE has while making the PNG transparent using filter CSS can be solved by using the Sleight.js but this script doesn't seems to be work for the background images (I mean, if the PNG images are loading as "background-image" style tag)

Basically, the Sleight.js works like as follows,

  1. Make the all images (img, input:image) int the document invisible
  2. Loop thru each and every PNG files
  3. Apply the filter option to the PNG file thru an Image object
  4. Make the all images (img, input:image) int the document visible

But, in the step 2 while it loops thru all the images, it cannot find the background images present in the document since document.images.length only gives the images that are presently visible and as well.

And, the way the images are loaded with transparency is with the below code,

function fnFixPng(img) {
	var src = img.src;
	img.style.width = img.width + "px";
	img.style.height = img.height + "px";
	img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + 
src +
"', sizingMethod='image')" img.src = "images/x.gif"; }

And, the script that calls this method to process the images is,

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) {
			fnFixPng(img);
     /// Other code //

So, Iam wondering how to find the background images present in the html page and process the PNG transparency.

Let me know if you something to say!!