mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 23:20:49 +03:00
Fixing the docs sidebar interactions
This commit is contained in:
parent
04d412ed16
commit
34a93fa1f3
6 changed files with 34 additions and 29 deletions
21
docs/static/js/scripts.js
vendored
21
docs/static/js/scripts.js
vendored
|
@ -8,17 +8,28 @@ function initializeJS() {
|
|||
|
||||
//sidebar dropdown menu
|
||||
jQuery('#sidebar .sub-menu > a').click(function () {
|
||||
var last = jQuery('.sub-menu.open', jQuery('#sidebar'));
|
||||
jQuery('.menu-arrow').removeClass('arrow_carrot-right');
|
||||
jQuery('.sub', last).slideUp(200);
|
||||
// Close previous open submenu
|
||||
var last = jQuery('.sub.open', jQuery('#sidebar'));
|
||||
jQuery(last).slideUp(200);
|
||||
jQuery(last).removeClass("open");
|
||||
jQuery('.menu-arrow', jQuery(last).parent()).addClass('fa-angle-right');
|
||||
jQuery('.menu-arrow', jQuery(last).parent()).removeClass('fa-angle-down');
|
||||
|
||||
// Toggle current submenu
|
||||
var sub = jQuery(this).next();
|
||||
if (sub.is(":visible")) {
|
||||
jQuery('.menu-arrow').addClass('arrow_carrot-right');
|
||||
jQuery('.menu-arrow', this).addClass('fa-angle-right');
|
||||
jQuery('.menu-arrow', this).removeClass('fa-angle-down');
|
||||
sub.slideUp(200);
|
||||
jQuery(sub).removeClass("open")
|
||||
} else {
|
||||
jQuery('.menu-arrow').addClass('arrow_carrot-down');
|
||||
jQuery('.menu-arrow', this).addClass('fa-angle-down');
|
||||
jQuery('.menu-arrow', this).removeClass('fa-angle-right');
|
||||
sub.slideDown(200);
|
||||
jQuery(sub).addClass("open")
|
||||
}
|
||||
|
||||
// Center menu on screen
|
||||
var o = (jQuery(this).offset());
|
||||
diff = 200 - o.top;
|
||||
if(diff>0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue