Created
February 22, 2010 21:20
-
-
Save westonruter/311513 to your computer and use it in GitHub Desktop.
Detect multiple backgrounds (inspired by Modernizr) using data: URI so no HTTP requests made
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
var url = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
var div = document.createElement('div'); | |
div.style.background = "url(" + url + "),url(" + url + "), black url(" + url + ")"; | |
if(!div.style.backgroundImage || div.style.backgroundImage.match(/url/g).length != 3){ | |
document.documentElement.className += " no-multiplebgs" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment