Skip to content

Instantly share code, notes, and snippets.

@mpgilbertusa
Created March 11, 2014 14:39
Show Gist options
  • Save mpgilbertusa/9487131 to your computer and use it in GitHub Desktop.
Save mpgilbertusa/9487131 to your computer and use it in GitHub Desktop.
Responsive Starter Kit Pro - Code Sample - Collapsible Content (Show-Hide) setup for global.js
<script>
$(document).ready(function () {
// collapsible content
if ($('.show-hide').length > 0) {
// Close by default
$('.show-hide .body').hide();
// Expand/collapse content when header is clicked
$('.show-hide .toggle').click(function(e) {
e.preventDefault();
var = $(this);
if (.hasClass('active')) {
.removeClass('active');
$(this).next('.body').slideUp('fast');
} else {
.removeClass('active');
.addClass('active');
$(this).next('.body').slideDown('fast');
}
});
// 'Hide' links for small screens
$('.show-hide .close-section').click(function(e) {
e.preventDefault();
$(this).parent('.body').slideUp('fast');
$(this).closest('.show-hide').find('.toggle').removeClass('active');
});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment