From ad97747b710776137c8b5548d63d79e6979a21a6 Mon Sep 17 00:00:00 2001 From: esn303 Date: Sat, 19 Jan 2013 22:48:16 +0100 Subject: [PATCH] added CSS class name support Copies the class name of the picture element over to the inserted img tag. --- picturefill.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/picturefill.js b/picturefill.js index b47bf1ea..1ad58dc5 100644 --- a/picturefill.js +++ b/picturefill.js @@ -79,6 +79,7 @@ var newImg = document.createElement("img"); newImg.src = source[0]; + newImg.className = ps[i].className; // When the image is loaded, set a width equal to that of the original’s intrinsic width divided by the screen resolution: newImg.onload = function() { // Clone the original image into memory so the width is unaffected by page styles: @@ -137,4 +138,4 @@ else if( w.attachEvent ){ w.attachEvent( "onload", w.picturefill ); } -})( this ); \ No newline at end of file +})( this );