Skip to content

Instantly share code, notes, and snippets.

@TimothyClayton
Last active August 29, 2015 14:16
Show Gist options
  • Save TimothyClayton/db97648af22c5d228870 to your computer and use it in GitHub Desktop.
Save TimothyClayton/db97648af22c5d228870 to your computer and use it in GitHub Desktop.
Easy expand/collapse
#expand-collapse-all
= image_tag('expand_all.png', id: 'expand-all', onclick: 'showAll()')
= image_tag('collapse_all.png', id: 'collapse-all', onclick: 'hideAll()')
.things-to-hide-or-show
.things-to-hide-or-show, #collapse-all {
display:none;
}
#expand-collapse-all {
cursor:pointer;
text-align:center;
}
function showAll() {
$('#expand-all').hide();
$('.things-to-hide-or-show, #collapse-all').show();
}
function hideAll() {
$('#collapse-all, .things-to-hide-or-show').hide();
$('#expand-all').show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment