參考網頁變灰:https://blog.csdn.net/oopxiajun2011/article/details/105318044
人名日報圖片點擊後由灰色變回彩色:https://mp.weixin.qq.com/s/JSntpqo0zi7ZsEC0K-xKpA
我自己花了2分鐘搞了一個類似於人民日報 這個效果。
<html>
<head>網頁內容逐步變灰</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<body>
<img style=" -webkit-filter: grayscale(100%);" src="17630702.jpg"></img>
<script>
var int;
var vue=100;
function change(){
if(vue>0){
vue=vue-1;
$('img').attr("style","-webkit-filter: grayscale("+vue+"%);");
}
else{
clearInterval(int);
}
}
$('img').click(function(){
int=self.setInterval("change()",100);
})
</script>
</body>
</html>