美文网首页
网页设置灰色与还原

网页设置灰色与还原

作者: 林玲玲的笔记 | 来源:发表于2022-12-24 11:51 被阅读0次

1.设置网页为灰色

//创建一个元素
var globalCss = document.createElement("style");
//设置这个元素的类型 <style type = "text/css"></style>
globalCss.type = "text/css";
//获取head标签,并把<style type = "text/css"></style>添加进去
document.getElementsByTagName("head")[0].append(globalCss)
//设置style标签的样式
globalCss.appendChild(document.createTextNode("html{-webkit-filter: grayscale(100%) !important; -moz-filter: grayscale(100%) !important;-ms-filter: grayscale(100%) !important;-o-filter: grayscale(100%) !important;filter: grayscale(100%) !important;filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1) !important;}"));

2.还原网页颜色

//创建一个元素
var globalCss = document.createElement("style");
//设置这个元素的类型 <style type = "text/css"></style>
globalCss.type = "text/css";
//获取head标签,并把<style type = "text/css"></style>添加进去
document.getElementsByTagName("head")[0].append(globalCss)
//设置style标签的样式
globalCss.appendChild(document.createTextNode("html{-webkit-filter:none !important;}"));
注:做的时候可以封装成一个方法,传入对应的参数进行调用即可。

相关文章

  • iphone wifi 图标不显示

    解决方案(亲测可用): 设置-通用-还原-还原网络设置

  • 还原位置与通讯录授权

    开发中经常需要还原位置与通讯录授权,以便可以重新进行授权,步骤如下: 设置 -> 通用 -> 还原 -> 还原位置...

  • 还原AS设置

    今天在AndroidStudio上不小心点到个快捷键,导致代码都红了但是却能运行。 猜到可能是修改了什么设置导致的...

  • 2022-04-14 npm install 报错 connec

    代理设置有误可以先还原: 如果想设置淘宝镜像再设置:

  • QQ浏览器使用infinity新标签

    浏览器设置---标签设置--新建标签时显示 ---自定义网页--设置网页---设置为 chrome://newta...

  • App Store无法下载问题和解决方法

    1.网路问题: 1.网络链接问题导致;换一个网试试; 2.网络设置问题;设置,进入通用,按还原,还原网络设置; 2...

  • 网页变灰色css

    为表达全国各族人民对抗击新冠肺炎疫情斗争牺牲烈士和逝世同胞的深切哀悼,国务院(4月3日)发布公告,决定2020年4...

  • 微信H5授权登录

    1、网页授权条件 1.1 设置 登录公众号,开发-接口全县-网页服务-网页账号-网页授权获取用户基本信息 设置...

  • oracle备份还原脚本

    @echo offecho 开始还原rem 设置还原路径set bakDir=F:\db_backuprem 数据...

  • Image

    直接圆角图片 设置圆角图片度数 设置圆角图片带灰色圆角边框 设置圆角图片带灰色圆角边框带阴影

网友评论

      本文标题:网页设置灰色与还原

      本文链接:https://www.haomeiwen.com/subject/kiibqdtx.html