dsandler.org

ds-sleight.

August 22nd, 2007

I got an email this morning asking for help with ds-sleight.js. I subsequently discovered that Google didn’t know anything about it except what other people have written. So here’s some quasi-official documentation:

ds-sleight is a small blob of JavaScript I’ve been using since the year 200X to force Internet Explorer to render the 8-bit alpha channel in 32-bit PNG images. (You might recall me whining about IE’s miserable support for PNG transparency back in 2002.)

There’s a little by way of instruction in the JavaScript source; here’s a slightly more verbose version of the installation procedure:

  1. Save a one-pixel transparent GIF (like this one) somewhere on your server (default path: /images/spacer.gif). Don’t hotlink it off dsandler.org, or I’ll hunt you down and kick your ass.
  2. Copy ds-sleight.js to your server as well.
  3. Add to any page that has a PNG with alpha:
    <script src="«path»/ds-sleight.js" type="text/javascript"></script>

It even (mostly) works on PNGs used as CSS background-images. Enjoy (if you haven’t already)!

You can leave a response, or trackback from your own site.

5 Responses to “ds-sleight.”

  1. Mandy Gagliardi  

    Ok.
    I LOVE your ds-sleight.js code however I am running across aproblem for the first time ever. It seems when I use this code and display the page in IE7 only half of my images show up. I know I can use browser detection and direct them to different pages but I do not want to have to maintain 2 versions of the site. Is it possible to do a browser detection and control the loading of the ds-sleight file? Or am I WAAAAAY off base and just not implementing your code properly?

    The site I am using it on right now is http://www.harmonydesignsandmore.com/leisa

    Thank you so much for taking the time to read this and for all the help you give the rest of us out here tearing our hair out over IE.

    comment posted at 8:55 pm on 09 Jan 2008

  2. Mandy Gagliardi  

    Sorry for the previous reply…DUH I figured it out. I am sorry to bother you.

    Thanks Again!

    comment posted at 9:00 pm on 09 Jan 2008

  3. Mike Freake  

    Hey,

    thanks for the code. Been looking all day for something like this. However, I am having a single problem.

    I’m using your ds-sleight.js for my div background-images. It works fine until I actually write something in my div. When I do I get a blank line, as though there were no background what so ever.

    Has anyone else had this problem? Would you like a screen shot?

    Thanks for any help.

    Mike

    comment posted at 1:37 pm on 29 Jan 2008

  4. dsandler  

    Mike,

    It’s worked for me in the past. If you want to post a screenshot (or better, a link to a minimal testcase) I’d be happy to take a look.

    comment posted at 12:10 pm on 05 Feb 2008

  5. harald  

    hey,

    great solution.
    but it doesn`t work with background-repeat: repeat-x; on ie 6,7
    can you check it?

    thx

    comment posted at 11:08 am on 25 Feb 2008

Leave a Reply

html help (show)
newer: Hey, genius… older: Grind.