Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery 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'});
Comment

PREVIOUS NEXT
Code Example
Javascript :: using dto in node js 
Javascript :: orbit controls drei 
Javascript :: set span text jquery 
Javascript :: install latest electron 
Javascript :: javascript two character integer 
Javascript :: js ternary 
Javascript :: javascript how to increment by other than one in for loop 
Javascript :: get params from route vuejs 
Javascript :: found page without a React Component as default export in 
Javascript :: javascript timeout 
Javascript :: smooth-scroll.js 
Javascript :: factorial javascript function 
Javascript :: detect resize window javascript 
Javascript :: all input value empty jquery 
Javascript :: format number with commas js 
Javascript :: push an property and value to an object in javascript 
Javascript :: does filter mutate array 
Javascript :: set auth header on axios instance 
Javascript :: js set canvas size 
Javascript :: javascript replace last occurrence of a letter 
Javascript :: jquery change page on click 
Javascript :: react-native eject not working 
Javascript :: @input and @output in angular 
Javascript :: lodash pick 
Javascript :: define function to get random value from array 
Javascript :: node js async delay 
Javascript :: javascript foreach example 
Javascript :: join array js 
Javascript :: js make id 
Javascript :: 00:00:00 / 00:00:00 js 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =