Line 125: | Line 125: | ||
menuItems.removeClass('hover'); | menuItems.removeClass('hover'); | ||
}); | }); | ||
+ | } | ||
+ | |||
+ | function hideOne(h, sec){ | ||
+ | sec.addClass('hide'); | ||
+ | h.addClass('collapsed'); | ||
} | } | ||
− | function | + | function showOne(h, sec){ |
− | var | + | var id = h.attr('id'); |
− | + | sec.removeClass('hide'); | |
− | + | h.removeClass('collapsed'); | |
− | + | ||
+ | if(id){ | ||
+ | window.location.hash = '#'+id; | ||
} | } | ||
− | function | + | h.parents('collapser').each(function(){ |
− | var | + | var h = $(this), sec = $('#sec-'+h.attr('id')); |
− | + | ||
− | + | ||
− | + | showOne(h, sec); | |
− | + | }); | |
− | + | } | |
− | + | ||
− | + | function collapsers(hlvl){ | |
− | + | var secs = $('.collapse'+ (hlvl ? '-' + hlvl : '')); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
function toggleOne(h, sec){ | function toggleOne(h, sec){ | ||
Line 205: | Line 206: | ||
}); | }); | ||
h.addClass('collapser'); | h.addClass('collapser'); | ||
− | |||
− | |||
− | |||
collapsers.all.push({sec: sec, h: h}); | collapsers.all.push({sec: sec, h: h}); | ||
Line 236: | Line 234: | ||
if(window.location.hash.length > 1){ | if(window.location.hash.length > 1){ | ||
− | var | + | var h = $(window.location.hash), sec; |
− | + | ||
− | if( | + | if(!h.length){ |
− | + | return; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
+ | |||
+ | sec = $('#sec-'+h.attr('id')); | ||
+ | |||
+ | showOne(h, sec); | ||
} | } | ||
} | } |
Revision as of 14:25, 17 October 2016