Skip to content

Instantly share code, notes, and snippets.

@robertosljunior
Created May 5, 2020 15:29
Show Gist options
  • Save robertosljunior/ac3e672999c1b76aec238adf70d11db0 to your computer and use it in GitHub Desktop.
Save robertosljunior/ac3e672999c1b76aec238adf70d11db0 to your computer and use it in GitHub Desktop.
// source http://jsbin.com
<style id="jsbin-css">
.demo-wrapper {
top: 0px;
position: fixed;
min-height: 50px;
width: 100%;
}
.slider {
overflow-y: hidden;
max-height: 0;
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
-moz-transition-property: all;
-moz-transition-duration: 1s;
-moz-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
-ms-transition-property: all;
-ms-transition-duration: 1s;
-ms-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
transition-property: all;
transition-duration: 1s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
background: #383a40;
height: 50px;
width: 100%;
}
.slider.closed {
max-height: 50px;
}
</style>
<meta name="description" content="Demo header">
<div class="demo-wrapper">
<div style="height: 50px; width: 100%; border: 1px solid #ccc;">
<div class="slider closed" id="slider">
</div>
</div>
<button onclick="document.getElementById('slider').classList.toggle('closed');">Sobe</button>
</div>
<script id="jsbin-javascript">
setTimeout(function(){
document.getElementById('slider').classList.toggle('closed')
}, 2000);
</script>
<script id="jsbin-source-html" type="text/html"><meta name="description" content="Demo header">
<div class="demo-wrapper">
<div style="height: 50px; width: 100%; border: 1px solid #ccc;">
<div class="slider closed" id="slider">
</div>
</div>
<button onclick="document.getElementById('slider').classList.toggle('closed');">Sobe</button>
</div>
</script>
.demo-wrapper {
top: 0px;
position: fixed;
min-height: 50px;
width: 100%;
}
.slider {
overflow-y: hidden;
max-height: 0;
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
-moz-transition-property: all;
-moz-transition-duration: 1s;
-moz-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
-ms-transition-property: all;
-ms-transition-duration: 1s;
-ms-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
transition-property: all;
transition-duration: 1s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
background: #383a40;
height: 50px;
width: 100%;
}
.slider.closed {
max-height: 50px;
}
setTimeout(function(){
document.getElementById('slider').classList.toggle('closed')
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment