Created
June 17, 2013 14:33
-
-
Save unfulvio/5797327 to your computer and use it in GitHub Desktop.
Make every <dd> (definition description) element in a <dl> (definition llist) toggleable by the <dt> (definition term) element. Useful for creating toggleable lists, FAQs lists, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#dl-container-id').on('click', 'dt.class-name', function() { | |
$(this).next().toggle(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** collapses the dd element in the dt-toggleable definition list by default **/ | |
#dl-container-id dd.class-name { display: none } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment