Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

wordpress jquery slide out navigation

'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'});
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #wordpress #jquery #slide #navigation
ADD COMMENT
Topic
Name
2+8 =