Skip to content

Commit

Permalink
added sample Modernizr test
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiemachado committed Sep 23, 2011
1 parent 66858fd commit d01f4f5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/js/scripts.js
Expand Up @@ -9,6 +9,16 @@ slow the page load.
*/

// Modernizr.load loading the right scripts only if you need them
Modernizr.load([
{
// Let's see if we need to load selectivizr
test : Modernizr.borderradius,
// Modernizr.load loads selectivizr for IE6-8
nope : ['selectivizr-min.js']
}
]);

/* imgsizer (flexible images for fluid sites) */
var imgSizer={Config:{imgCache:[],spacer:"/path/to/your/spacer.gif"},collate:function(aScope){var isOldIE=(document.all&&!window.opera&&!window.XDomainRequest)?1:0;if(isOldIE&&document.getElementsByTagName){var c=imgSizer;var imgCache=c.Config.imgCache;var images=(aScope&&aScope.length)?aScope:document.getElementsByTagName("img");for(var i=0;i<images.length;i++){images[i].origWidth=images[i].offsetWidth;images[i].origHeight=images[i].offsetHeight;imgCache.push(images[i]);c.ieAlpha(images[i]);images[i].style.width="100%";}
if(imgCache.length){c.resize(function(){for(var i=0;i<imgCache.length;i++){var ratio=(imgCache[i].offsetWidth/imgCache[i].origWidth);imgCache[i].style.height=(imgCache[i].origHeight*ratio)+"px";}});}}},ieAlpha:function(img){var c=imgSizer;if(img.oldSrc){img.src=img.oldSrc;}
Expand Down

0 comments on commit d01f4f5

Please sign in to comment.