I want to use CSS's property :
mix-blend-mode: soft-light;
And I will test by Modernizr for fallback bla bla...
Tested :
Modernizr.mixblendmode //undefined
Modernizr.testProp('mixblendmode'); //false
Modernizr.addTest('mixblendmode'); // no-mixblendmode
What am I missing ?
Tested on Firefox, CSS its work, but how to test with Modernizr ?
Modernizr doesn't support this currently. From Modernizr/issues/1388:
Unfortunatly, "[...] in some browsers, mix-blend-mode is implemented; the property is valid, the automated tests pass, but no blending actually takes place" - http://blogs.adobe.com/webplatform/2013/09/12/browser-support-matrix-for-css-blending/
Got it :
Modernizr.addTest('mix-blend-mode', function(){
return Modernizr.testProp('mixBlendMode');
});
(or without Modernizr)
if('CSS' in window && 'supports' in window.CSS) {
var support = window.CSS.supports('mix-blend-mode','multiply');
/* Add class like Modernizr */
/* -- jQuery -- */
$('html').addClass(support?'mix-blend-mode':'no-mix-blend-mode'); // jQuery
/* -- Pure JS -- */
document.getElementsByTagName('html')[0].className += support ? ' mix-blend-mode' : ' no-mix-blend-mode';
/* -- Pure JS (IE9+) -- */
document.querySelector('html').classList.add(support ? 'mix-blend-mode' : 'no-mix-blend-mode');
}
(or CSS)
@supports(mix-blend-mode:multiply) {
}
Ref : https://dev.opera.com/articles/getting-to-know-css-blend-modes/
Can I use : http://caniuse.com/#feat=css-mixblendmode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With