src/openseadragon.js
function( src ) {

            $.makeTransparentImage = function( src ){
                var img = $.makeNeutralElement( "img" );

                img.src = src;

                return img;
            };

            if ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 7 ) {

                $.makeTransparentImage = function( src ){
                    var img     = $.makeNeutralElement( "img" ),
                        element = null;

                    element = $.makeNeutralElement("span");
                    element.style.display = "inline-block";

                    img.onload = function() {
                        element.style.width  = element.style.width || img.width + "px";
                        element.style.height = element.style.height || img.height + "px";

                        img.onload = null;
                        img = null;     // to prevent memory leaks in IE
                    };

                    img.src = src;
                    element.style.filter =
                        "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
                        src +
                        "', sizingMethod='scale')";

                    return element;
                };

            }

            return $.makeTransparentImage( src );
        }
function( src ) {

            $.makeTransparentImage = function( src ){
                var img = $.makeNeutralElement( "img" );

                img.src = src;

                return img;
            };

            if ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 7 ) {

                $.makeTransparentImage = function( src ){
                    var img     = $.makeNeutralElement( "img" ),
                        element = null;

                    element = $.makeNeutralElement("span");
                    element.style.display = "inline-block";

                    img.onload = function() {
                        element.style.width  = element.style.width || img.width + "px";
                        element.style.height = element.style.height || img.height + "px";

                        img.onload = null;
                        img = null;     // to prevent memory leaks in IE
                    };

                    img.src = src;
                    element.style.filter =
                        "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
                        src +
                        "', sizingMethod='scale')";

                    return element;
                };

            }

            return $.makeTransparentImage( src );
        }
function ( src ) { $ . makeTransparentImage = function ( src ) { var img = $ . makeNeutralElement ( "img" ) ; img . src = src ; return img ; } ; if ( $ . Browser . vendor == $ . BROWSERS . IE && $ . Browser . version < 7 ) { $ . makeTransparentImage = function ( src ) { var img = $ . makeNeutralElement ( "img" ) , element = null ; element = $ . makeNeutralElement ( "span" ) ; element . style . display = "inline-block" ; img . onload = function ( ) { element . style . width = element . style . width || img . width + "px" ; element . style . height = element . style . height || img . height + "px" ; img . onload = null ; img = null ; // to prevent memory leaks in IE } ; img . src = src ; element . style . filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')" ; return element ; } ; } return $ . makeTransparentImage ( src ) ; }
Ensures an image is loaded correctly to support alpha transparency.
Generally only IE has issues doing this correctly for formats like
png.
@function
@param {String} src
@returns {Element}
Ensures an image is loaded correctly to support alpha transparency . Generally only IE has issues doing this correctly for formats like png .