全国公祭日,2020年4月4日上午10点,为抗疫英雄默哀3分钟

754 阅读1分钟

我是一个程序员。但我愿尽我所能,致敬抗疫英雄,行动起来吧,everybody。

js:

<script>
    let startTime=1585903080000;//开始时间
    let endTime=1585965780000;//结束时间
    let currentTime = Date.parse(new Date());//当前时间

    $(document).ready(function(){
        if(startTime<currentTime&&currentTime<endTime){
            $("#body").addClass("gray");
        }
    });
</script>

css:

<style>
    .gray {
        -webkit-filter: grayscale(100%);-moz-filter: grayscale(100%);-ms-filter: grayscale(100%);
        -o-filter: grayscale(100%);filter: grayscale(100%);filter: gray;
    }
</style>

灰度效果很好,视频也能灰掉。