From e21e0ac5c352cd966ea7cdb27490a76fcc9418ba Mon Sep 17 00:00:00 2001 From: Jono Brandel Date: Thu, 3 Feb 2011 14:36:28 -0800 Subject: [PATCH] css3 animations work for documentation page, thanks szimek! --- demo/demo.css | 36 ++++++++++++++++++------- index.html | 74 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 72 insertions(+), 38 deletions(-) diff --git a/demo/demo.css b/demo/demo.css index 966a9ad..0d52950 100644 --- a/demo/demo.css +++ b/demo/demo.css @@ -49,14 +49,14 @@ h2 { } h2.section { -margin: 0; -padding: 20px 0 20px; -cursor: pointer; -border-top: 1px dotted #ccc; --webkit-transition: color 0.15s linear; + margin: 0; + padding: 20px 0 20px; + cursor: pointer; + border-top: 1px dotted #ccc; + -webkit-transition: color 0.15s linear; } h2.section:hover { -color: #00aeff; + color: #00aeff; } div.collapsed h2, div.expanded h2 { @@ -66,11 +66,14 @@ div.collapsed h2, div.expanded h2 { width: 100%; cursor: pointer; } -h2.last { -border-bottom: 1px dotted #ccc; -margin-bottom: 20px; -} +div.trans { + border-top: 1px dotted #ccc; + margin: 0px 0px 20px 0px; +} +ol#secrets { + padding: 0px 0px 20px 0px; +} div.expanded h2:before { content: '-'; } @@ -87,6 +90,18 @@ div.expanded h2:before, div.collapsed h2:before { font-family: Monaco, monospace; } +div.collapsable { + overflow: hidden; + clear: both; + -moz-transition: height .2s ease-out; + -webkit-transition: height .2s ease-out; + transition: height .2s ease-out; +} + +div.collapsable div { + height: auto; +} + div.collapsed .collapsable { overflow: hidden; clear: both; @@ -97,6 +112,7 @@ div.expanded .collapsable { clear: both; height: auto; } + div.expanded { cursor: pointer; } #helvetica-demo { diff --git a/index.html b/index.html index 00632bf..ddf2c2b 100644 --- a/index.html +++ b/index.html @@ -72,10 +72,15 @@ function toggle(e) { - if(this.className == 'collapsed') { + var collapsable = this.childNodes[3], + wrapper = collapsable.childNodes[1]; + + if (this.className === 'collapsed') { this.className = 'expanded'; + collapsable.style.height = wrapper.clientHeight + 'px'; } else { this.className = 'collapsed'; + collapsable.style.height = '0px'; } } @@ -186,20 +191,22 @@ window.onload = function() { -