You could use a work around like this one. It involves toggling a left value (via a class) for both the fixed element and the container.
.global-wrapper {
position: relative;
-webkit-transition: 300ms;
transition: 300ms;
}
.global-wrapper.expanded,
.global-wrapper.expanded .navbar {
left: 200px;
}
.navbar {
-webkit-transition: 300ms;
transition: 300ms;
position: fixed;
width: 100px;
height: 100%;
top: 0px;
left: 0px;
}
.content {
position: relative;
width: calc(100% - 170px); /* 100% - width of left bar plus margin */
}
With a small amount of vanilla JS to toggle it the class:
var wrapper = document.querySelector(".global-wrapper");
document.getElementById("expand").onclick = function() {
wrapper.classList.toggle("expanded");
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…