Skip to content

Instantly share code, notes, and snippets.

@niceaji
Created March 27, 2014 00:06
Show Gist options
  • Save niceaji/9796798 to your computer and use it in GitHub Desktop.
Save niceaji/9796798 to your computer and use it in GitHub Desktop.
var CssFilterSupport = {
checkSupport : function(testCase){
return window.CSS && _.isFunction(CSS.supports) && (CSS.supports("-webkit-filter", testCase) || CSS.supports("filter", testCase));
},
blur : function(){
return this.checkSupport("blur(10px)");
},
brightness : function(){
return this.checkSupport("brightness(1)");
},
contrast : function(){
return this.checkSupport("contrast(1)");
},
dropShadow : function(){
return this.checkSupport("drop-shadow(5px 5px 5px black)");
},
grayscale : function(){
return this.checkSupport("grayscale(1)");
},
hueRotate : function(){
return this.checkSupport("hue-rotate(10deg)");
},
invert : function(){
return this.checkSupport("invert(1)");
},
opacity : function(){
return this.checkSupport("opacity(1)");
},
saturate : function(){
return this.checkSupport("saturate(1)");
},
sepia : function(){
return this.checkSupport("sepia(1)");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment