Sha256: ec2c3976ff8e800ba130dbc4bdbec711a6740cc38eb6be80ebaae696259ad7a5

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

/**
 * Correctly handle PNG transparency in Win IE 5.5 & 6.
 * http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
 * 
 * Use in <HEAD> with DEFER keyword wrapped in conditional comments:
 * 
 *   <!--[if lt IE 7]>
 *   <script defer type="text/javascript" src="pngfix.js"></script>
 *   <![endif]-->
 * 
 */

var arVersion = navigator.appVersion.split("MSIE"),
    version = parseFloat(arVersion[1]),
    filters = false;
    
try { filters = !!document.body.filters }
catch (e) {}

if (version >= 5.5 && filters) {
  $A(document.images).each(function(img) {
    if (!img.src.toLowerCase().endsWith('png')) return;
    
    var span = new Element('span', { id: img.id, className: img.className, title: (img.title || img.alt) }).
      setStyle({
        display: 'inline-block',
        width: img.width + 'px',
        height: img.height + 'px',
        filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + img.src + '", sizingMethod="scale")'
      }).
      setStyle(img.style.cssText);
    
    if (img.align == "left")       span.setStyle("float: left");
    else if (img.align == "right") span.setStyle("float: right");
    if (img.parentElement.href)    span.setStyle("cursor: hand");
    
    $(img).replace(span);
  });
}

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
radiantcms-couchrest_model-0.2.4 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.2.2 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.2.1 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.2 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.1.9 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.1.8 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.1.7 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.1.6 public/javascripts/pngfix.js
radiantcms-couchrest_model-0.1.5 public/javascripts/pngfix.js
radiant-0.7.2 public/javascripts/pngfix.js
radiant-0.8.2 public/javascripts/pngfix.js
radiant-rc-0.9.0 public/javascripts/admin/pngfix.js
radiant-0.8.1 public/javascripts/pngfix.js
metry-2.0.4 radiant/example/public/javascripts/pngfix.js
metry-2.0.5 radiant/example/public/javascripts/pngfix.js
metry-2.1.0 radiant/example/public/javascripts/pngfix.js
metry-2.1.1 radiant/example/public/javascripts/pngfix.js
metry-2.0.0 radiant/example/public/javascripts/pngfix.js
metry-2.0.1 radiant/example/public/javascripts/pngfix.js
metry-2.0.2 radiant/example/public/javascripts/pngfix.js