如何更改#clip-home.open clip-path 值#clip-home { z-index: 2; clip-path: circle(2em); transition: all 1.5s ease;}#clip-home.open { background-color: #45a26f; clip-path: circle(300px);}
2 回答
慕莱坞森
TA贡献1810条经验 获得超4个赞
像这样:
document.getElementById("clip-home").style.clipPath = "circle(10px)"
遵循完整的工作代码:
document.getElementById("clip-home").style.clipPath = "circle(10px)"
#clip-home {
z-index: 2;
clip-path: circle(2em);
transition: all 1.5s ease;
width: 300px;
height: 300px;
background-color: black;
}
#clip-home.open {
background-color: #45a26f;
clip-path: circle(300px);
}
<div id="clip-home"></div>
添加回答
举报
0/150
提交
取消