Last active
          December 22, 2015 02:59 
        
      - 
      
- 
        Save jamesmfriedman/6407114 to your computer and use it in GitHub Desktop. 
Revisions
- 
        jamesmfriedman revised this gist Sep 1, 2013 . 2 changed files with 11 additions and 11 deletions.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ img.responsive-image { padding: 50%; /*controls the ratio of the image. 37.5% 50% would be a 4 x 3 image*/ width: 0; height:0; background-size: cover; background-position: center center; } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,12 +5,12 @@ $(function() { var __init__ = function() { $('.responsive-image:not(.responsive-image-fixed)').each(function(){ var img = $(this); img.addClass('responsive-image-fixed'); img.attr('style', 'background-image: url('+ img.attr('src') +');'); }); } __init__(); }); 
- 
        jamesmfriedman created this gist Sep 1, 2013 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ img.responsive-image { padding: 50%; /*controls the ratio of the image. 37.5% 50% would be a 4 x 3 image*/ width: 0; height:0; background-size: cover; background-position: center center; } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ /** * Quick little utiltiy that makes an image responsive by changing it to a background photo * Just add class of 'responsive-image' */ $(function() { var __init__ = function() { $('.responsive-image:not(.responsive-image-fixed)').each(function(){ var img = $(this); img.addClass('responsive-image-fixed'); img.attr('style', 'background-image: url('+ img.attr('src') +');'); }); } __init__(); });