-
-
Save charleslouis/5402902 to your computer and use it in GitHub Desktop.
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 characters
/** | |
* Add Modernizr test for box sizing | |
*/ | |
Modernizr.addTest("boxsizing", function(){ | |
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7); | |
}); | |
/** | |
* Change the width of all elements to account for border-box | |
*/ | |
$(function(){ | |
if(!($('html').hasClass('boxsizing'))){ | |
$('*').each(function(){ | |
if($(this).css('display')=='block'){ | |
var f, a, n; | |
f = $(this).outerWidth(); | |
a = $(this).width(); | |
n = a-(f-a); | |
$(this).css('width', n); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment