As the implementation of blend-mode is still being broadcast in the case of browsers like IE 11 and others that do not support it would be nice if you already let the code work if they ever saw to enable this function (in the case of microsoft in edge now).
You can check the compatibility of browsers with blend mode by running this script:
var supportsMixBlendMode =
window.getComputedStyle(document.body).mixBlendMode,
supportsBackgroundBlendMode =
window.getComputedStyle(document.body).backgroundBlendMode;
console.log(supportsMixBlendMode);
console.log(supportsBackgroundBlendMode);
If the value returned is normal the browser has compatibility but return
undefined
, there is no way, nor vendor prefixes
resolves!
However, I believe you can do some other legal effect for these browsers,
or through JS, checking these variables above and applying a differentiated style
should he return undefined
, or also, you can use the famous "hack" for CSS.
Here is a list of some for IE for example:
http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/
I believe that to do something really cool maybe with zoom images or control
opacity as you said yourself, there goes the imagination and what combines best with the layout!
I hope I helped, and please,
whether it has been useful to assess opinion and attempt to resolve the problem,
hug!
references:
- http://dev.modern.ie/platform/status/mixblendmode/
- http://css-tricks.com/basics-css-blend-modes/
You can for example do the check as follows:
<script>
var t = window.getComputedStyle(document.body).mixBlendMode,
s = window.getComputedStyle(document.body).backgroundBlendMode;
if (undefined == (t&&s)) {
//Aqui vai seu codigo ex.:
//document.body.classList.add('n-blendMode');
//document.body.style.color = "#000";
}
</script>
I edited my question, see what you think...
– JefSilva
Regarding the support is also very useful, but it works with superscript, IE, where the first value is red and if there is blendMode is changed.. however as you will use opacity, you would also have to overwrite this property. Reusing the above example would be: b { background-color: red; opacity: 0.3; } @Supports ( background: linear-gradient(0deg,red,red) ) { b { background: linear-gradient( 0deg, rgb(65, 150, 44), rgb(26, 219, 73) ); opacity: 0.8; } } Where, if supporting property the opacity would be 0.8 as you said, and if not support would be 0.3;
– Rafael Kendrik
Yeah, actually solving only with CSS would be better, but since Safari still doesn’t implement @Upports, I’m thinking I’d better use JS.
– JefSilva