网站变灰
js自己去找 <script src="grayscale.js" type="text/javascript"></script> <script type="text/javascript"> var browserName = navigator.userAgent.toLowerCase(); var mybrowser = { version: (browserName.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, '0'])[1], safari: /webkit/i.test(browserName) && !this.chrome, opera: /opera/i.test(browserName), firefox:/firefox/i.test(browserName), ie: /msie/i.test(browserName) && !/opera/.test(browserName), mozilla: /mozilla/i.test(browserName) && !/(compatible|webkit)/.test(browserName) && !this.chrome, chrome: /chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName) } if(mybrowser.mozilla || mybrowser.safari || mybrowser.opera){ window.onload=function(){ grayscale(document.body); } } </script type="text/css"> <style> html{ filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); } </style>
另外一种不用js的,兼容firefox的
html{ filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(1); }
相关推荐
longzhiwen 2020-10-16
tkernel 2020-08-18
lihn 2020-08-18
liuweiq 2020-07-08
Colourful 2020-07-03
sunzhihaofuture 2020-06-10
ZHANGRENXIANG00 2020-06-09
fangjack 2020-06-02
88961137 2020-06-01
marisafari 2020-05-29
jiaguoquan00 2020-05-27
心得笔记 2020-05-11
fanhuasijin 2020-04-17
四叶草 2020-03-24
juanjuanwang 2020-03-23
81224450 2020-01-24
程序员俱乐部 2020-01-11
baynkbtg 2020-01-10