<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<style>
#setxfld{
color:cyan;
font-size: 30px;
}
</style>
<div id="setxfld">文字 </div>
<input type="button" value="按钮" id="btn">
<script>
var colorFlag = 0;
$("#btn").on("click",function(){
var t1=setInterval(function changeColor() {
if (!colorFlag)
{
$("#setxfld").css("color","red");
$("#setxfld").css("fontSize","50px");
//console.log("1")
colorFlag = 1;
}else{
$("#setxfld").css("color","cyan");
$("#setxfld").css("fontSize","30px");
colorFlag = 0;
//console.log("0")
}
},800);
setTimeout(function yan(){
clearInterval(t1);
},8000)
})
</script>
</body>
</html>
点击按钮字体颜色变化和放大
猜你喜欢
转载自blog.csdn.net/wzwzwz555/article/details/88356102
今日推荐
周排行