Created
March 11, 2014 14:39
-
-
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
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
<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