function myFunction1() {
var a = document.getElementById("hidden_box_tr");
var b = document.getElementById("updown");
var c = document.getElementById("caution");
if (a.style.display === "block") {
a.style.display = "none";
a.style.height = "10px";
b.style.transform = "rotate(90deg)";
c.style.opacity = "0";
} else {
a.style.display = "block";
a.style.height = "150px";
a.style.margin = "0px 0px 88px 0px";
b.style.transform = "rotate(270deg)";
c.style.opacity = "1";
}
}
.caution {opacity:0;}
#hidden_box_tr {color:#453367;
height:10px;
overflow:hidden;
display:none;
transition: all 10s;}
.hidden_box {margin-bottom:20px;}
.toggle_button > p {display:inline-block;
font-weight:bold;
font-size:20px;
margin-bottom:50px;
cursor:pointer;}
#updown {transform: rotate(90deg);
transition: all 1s;}
<div class="toggle_button" onclick="myFunction1()">
<p>click here</p><p id="updown">></p>
</div>
<div class="hidden_box">
<table>
<tr id="hidden_box_tr" >
<td id="caution">test</td>
<td id="caution">
</td>
</tr>
</table>
</div>
当 #hidden_box_tr 高度为 150px 时,我想添加“transition: height 10s”。现在看起来它突然改变了高度,但我希望它通过使用过渡来非常平滑地改变
但它不起作用
任何帮助将非常感激!谢谢!!
一只萌萌小番薯
慕斯709654
相关分类