Skip to content

Commit

Permalink
added a class to the HTML class when a device is deemed large enough …
Browse files Browse the repository at this point in the history
…for image swapping. This lets you include images of different dimensions for small and large sizes. For example, the small size could be cropped as a small square, whereas the large size could be a wide rectangle shape. This class allows you to style the small and large images differently, since their shape may affect the layout.
  • Loading branch information
scottjehl committed May 18, 2011
1 parent e88dc8a commit b306f5e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rwd-images/rwd-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
var rwdi = (function(){
var defaults = {
clientSideOnly: false,
widthBreakPoint: 480
widthBreakPoint: 480,
htmlClass: "rwd-imgs-lrg"
};
//mixins from rwd_images global
if( 'rwd_images' in win ){
Expand Down Expand Up @@ -40,6 +41,9 @@
return;
}

//add HTML class
doc.documentElement.className += " " + rwdi.htmlClass;

//find and replace img elements
var findrepsrc = function(){
var imgs = doc.getElementsByTagName('img'),
Expand Down

0 comments on commit b306f5e

Please sign in to comment.