css

.gray{
      filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
  -webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);
  -ms-filter:grayscale(100%);
  -o-filter:grayscale(100%);
  filter:grayscale(100%);
  filter:gray;
}

html判断条件添加和删除样式

 if (res.configDate == res.localDate) {
        document.querySelector("html").classList.add("gray");
      } else {
        if (document.querySelector("html").className.indexOf('gray') !== -1) {
          document.querySelector("html").remove("gray");
        }
      }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2021-12-17
  • 2022-12-23
  • 2022-03-10
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案