47638c5e15
Change-Id: I7f4ec771315fe9ed79d723c7bbf199f88e9ee092
32 lines
883 B
JavaScript
32 lines
883 B
JavaScript
$(document).ready(function() {
|
|
|
|
// for each trigger
|
|
$('.trigger').each(function() {
|
|
|
|
// check if cookie has value on true
|
|
if ($.cookie($(this).parent().prop('id')) == "true") {
|
|
// add displayed class and show the content
|
|
$(this).parent().addClass("displayed");
|
|
$(this).next('.content').show();
|
|
|
|
} else {
|
|
// remove displayed class and hide the content
|
|
$(this).parent().removeClass("displayed");
|
|
$(this).next('.content').hide();
|
|
}
|
|
});
|
|
|
|
// if user clicked trigger element
|
|
$('.trigger').click(function() {
|
|
|
|
// toggle parent's class and animate the content
|
|
$(this).parent().toggleClass('displayed');
|
|
$(this).next('.content').slideToggle("fast");
|
|
|
|
// save the state to cookies
|
|
$.cookie($(this).parent().prop('id'),
|
|
$(this).parent().hasClass('displayed'),
|
|
{ path: '/' });
|
|
});
|
|
});
|