I use below code for my left sidebar and display on a browser is hide/show, but didn't work on the right sidebar note: sidebar still visible on the browser (button scroll appears)(我在左侧边栏上使用以下代码,并且在浏览器上的显示是隐藏/显示,但在右侧边栏上却不起作用。注意:边栏在浏览器上仍然可见(出现按钮滚动))
<div id="right-sidebar">
<div class="content-right">
<div class="row">
<div class="col">
<p>this column 1</p>
</div>
<div class="col">
<p>this column 1</p>
</div>
<div class="col">
<p>this column 1</p>
</div>
</div>
<button class="close-right" onclick="Toggle()">
<img src="./images/arrow.png" alt="">
</button>
</div>
</div>
CSS(的CSS)
#right-sidebar {
align-items: center;
position: absolute;
display: flex;
max-width: 50%;
height: 900px;
right: -100%;
transition: .5s;
-webkit-transition: .5s;
-moz-transition: .5s;
-ms-transition: .5s;
-o-transition: .5s;
background-color: #fff;
box-shadow: 0 0 30px gray;
}
JS(JS)
function Toggle(){
let x = document.getElementById("right-sidebar")
if ( x.style.right == "0%" ) x.style.right = "-100%";
else {
x.style.right = "0%";
}
}
ask by tapriandi translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…