📅  最后修改于: 2022-03-11 15:04:32.498000             🧑  作者: Mango
'use strict';
function slideOutNavBar ({$=jQuery, nav='nav', ul='ul', but='button', speed='fast'}) {
// target the childern of the parent nav container
const navBar = $(nav);
const button = navBar.find(but);
const panel = navBar.find(ul);
if (!navBar) {
console.error('Parent navbar not selected properly');
return;
}
if (!button) {
console.error('Parent navbar not selected properly');
return;
}
if (!panel) {
console.error('Parent navbar not selected properly');
return;
}
button.click(() => {
panel.slideToggle(speed);
});
}
slideOutNavBar({nav:'#access', ul:'#nav-panel', but:'#toggle'});