Commit 4a98d32a by Bence Dányi

webui: animate height instead of max-height

parent 7140d8c6
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<style> <style>
.container { .container {
width: 400px; width: 400px;
-webkit-transition: max-height 700ms; -webkit-transition: height 700ms;
max-height: 0px; height: 0px;
overflow: hidden; overflow: hidden;
background-color: red; background-color: red;
} }
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
document.getElementById('toggle-css-btn').onclick=function(){ document.getElementById('toggle-css-btn').onclick=function(){
var el=$('#toggle-css'); var el=$('#toggle-css');
if(!el.hasClass('opened')) { if(!el.hasClass('opened')) {
el.css('max-height', el.find('.details')[0].offsetHeight||'1000px'); el.css('height', el.find('.details')[0].offsetHeight||'1000px');
} else { } else {
el.css('max-height', '0px'); el.css('height', '0px');
} }
$('#toggle-css').toggleClass('opened'); $('#toggle-css').toggleClass('opened');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment