Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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

PREVIOUS NEXT
Code Example
Javascript :: scrolltop in javascript 
Javascript :: how to change color on js 
Javascript :: JS automate a click 
Javascript :: vanilla javascript fade out 
Javascript :: javascript two digits number 
Javascript :: angular stoppropagatio 
Javascript :: node how to stop NodeJS server process 
Javascript :: nuxt emit 
Javascript :: javascript intl.numberformat reais 
Javascript :: javascript cancel timeout 
Javascript :: javascript string to lowercase 
Javascript :: count value a to b character javascript 
Javascript :: javascript enum 
Javascript :: react public pic 
Javascript :: regex optional whitespace characters 
Javascript :: css canvas set aspect ratio 
Javascript :: how to get array from number length 
Javascript :: js map array to dictionary 
Javascript :: event.preventdefault is not a function jquery 
Javascript :: $lookup in mongodb 
Javascript :: syntax function 
Javascript :: using multiparty with node js express 
Javascript :: how to add new key value to json object in javascript 
Javascript :: discord.js remove every role a user has 
Javascript :: Encountered two children with the same key, `undefined`. flatlist 
Javascript :: res.locals in express 
Javascript :: shuffle array item javascruitp 
Javascript :: .join in javascript 
Javascript :: react state array 
Javascript :: header logo react native img 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =