Created
March 21, 2011 10:35
-
-
Save DimitarChristoff/879276 to your computer and use it in GitHub Desktop.
mootools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
document.getElements('img[src$=png]').each(function(img, i) { | |
var oldId = img.id; | |
img.setProperty("id", "old"+i); | |
var imgID = "id='clone" + i + "' "; | |
var imgClass = (img.className) ? "class='" + img.className + "' " : "" | |
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " | |
var imgStyle = "display:inline-block;" + img.style.cssText | |
if (img.align == "left") imgStyle = "float:left;" + imgStyle | |
if (img.align == "right") imgStyle = "float:right;" + imgStyle | |
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle | |
var strNewHTML = "<span " + imgID + imgClass + imgTitle | |
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" | |
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" | |
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" | |
img.outerHTML = strNewHTML; | |
$("clone"+i).cloneEvents(img).setProperties(img.getProperties('alt','rel','title','id')); | |
}); // each | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment