Last active
October 25, 2015 16:52
-
-
Save mhulse/6ec4db51a61eb958b82d to your computer and use it in GitHub Desktop.
A simple JS check to see if CSS mix-blend-mode is supported.
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
<!doctype html> | |
<html class="no-blend"> | |
<head> | |
<script>/* Put no-blend.js code here, sooner rather than later. */</script> | |
</head> | |
<body> | |
... | |
</body> | |
</html> |
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
/* Example CSS usage: */ | |
.blend body { background: #fff url(../images/grunge.gif) center top; } |
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
/*! no-blend | https://gist.github.com/mhulse/6ec4db51a61eb958b82d */ | |
;(function(window, document) { | |
(window.getComputedStyle(document.head, null).mixBlendMode) && (document.documentElement.className = document.documentElement.className.replace(/\bno-blend\b/, 'blend')); | |
}(window, document)); | |
/*! no-blend uglified | https://gist.github.com/mhulse/6ec4db51a61eb958b82d */!function(e,n){e.getComputedStyle(n.head,null).mixBlendMode&&(n.documentElement.className=n.documentElement.className.replace(/\bno-blend\b/,"blend"))}(window,document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
H/T: Basics of CSS Blend Modes