Permalink
Browse files

Automatically hide toggle elements.

  • Loading branch information...
1 parent 468df84 commit 2dffa1e6fa141111ff751f20e03f1314d9c2e758 @rrthomas rrthomas committed May 7, 2012
Showing with 14 additions and 6 deletions.
  1. +4 −4 index.html
  2. +3 −0 verdict.coffee
  3. +7 −2 verdict.js
View
@@ -246,17 +246,17 @@
<div class='desc'>
<h2>Toggle</h2>
<div class='example'>
- <blockquote>Theodore Robert "Ted" Bundy was an American <span class='toggle' id='ted1'><span>serial killer</span><span style="display: none">serial entrepreneur</span></span> and <span id='ted2' class='toggle' ><span style="display: none">rapist</span><span>rapper</span><span style="display: none">flapper</span></span> who assaulted and murdered numerous young women during the 1970s, and possibly earlier. </blockquote>
+ <blockquote>Theodore Robert "Ted" Bundy was an American <span class='toggle' id='ted1'><span>serial killer</span><span>serial entrepreneur</span></span> and <span id='ted2' class='toggle' ><span>rapist</span><span>rapper</span><span>flapper</span></span> who assaulted and murdered numerous young women during the 1970s, and possibly earlier. </blockquote>
<pre class='sh_javascript_dom'>
&lt;span class='toggle' id='ted1'&gt;
&lt;span&gt;serial killer&lt;/span&gt;
- &lt;span style="display: none;"&gt;serial entrepreneur&lt;/span&gt;
+ &lt;span&gt;serial entrepreneur&lt;/span&gt;
&lt;/span&gt;
&lt;span id='ted2' class='toggle' &gt;
- &lt;span style="display: none"&gt;rapist&lt;/span&gt;
+ &lt;span&gt;rapist&lt;/span&gt;
&lt;span&gt;rapper&lt;/span&gt;
- &lt;span style="display: none"&gt;flapper&lt;/span&gt;
+ &lt;span&gt;flapper&lt;/span&gt;
&lt;/span&gt;
$("#ted1").toggle_select();
View
@@ -74,6 +74,9 @@
# Add the event handlers
toggle = (elem) ->
+ children = elem.children()
+ for i in [1...children.length]
+ children[i].style.display = "none"
elem.click (e) ->
children = elem.children()
n = 0
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 2dffa1e

Please sign in to comment.