Click here to Skip to main content
14,663,933 members
Home » Discussions » JavaScript
   

JavaScript

 
QuestionHow do you pause an animation? Pin
Marc Hede18-Dec-19 2:55
MemberMarc Hede18-Dec-19 2:55 
QuestionImages are not loading that are referenced in CSS Pin
simpledeveloper17-Dec-19 13:10
Membersimpledeveloper17-Dec-19 13:10 
AnswerRe: Images are not loading that are referenced in CSS Pin
Richard MacCutchan17-Dec-19 21:54
mveRichard MacCutchan17-Dec-19 21:54 
GeneralRe: Images are not loading that are referenced in CSS Pin
simpledeveloper18-Dec-19 7:34
Membersimpledeveloper18-Dec-19 7:34 
GeneralRe: Images are not loading that are referenced in CSS Pin
Richard MacCutchan18-Dec-19 21:22
mveRichard MacCutchan18-Dec-19 21:22 
GeneralRe: Images are not loading that are referenced in CSS Pin
F-ES Sitecore20-Dec-19 4:03
mveF-ES Sitecore20-Dec-19 4:03 
GeneralRe: Images are not loading that are referenced in CSS Pin
simpledeveloper20-Dec-19 8:23
Membersimpledeveloper20-Dec-19 8:23 
QuestionHow do I close this menu automatically after clicking link? Pin
Melissa Anthonia17-Dec-19 8:38
MemberMelissa Anthonia17-Dec-19 8:38 
Greetings.
I am working on a one-page solution where each section has an ID.
I have made this very simple responsive menu, which looks quite nice, but I have noticed one major flaw.
In mobile view, if I click on a list from the navbar slide-menu, the page will scroll down to that particular ID. The problem is that the user needs to click on the navbar to manually close it, meaning that if they click on one of the links, they won't actually know if they are taken to that section, because the menu is in the way.

What I want is for the menu to close after clicking the link, so that people can see the page scrolling down to the section they were looking for.
How can I accomplish this?

If possible I would like an ES6 solution without JQuery

console.clear();
const navSlide= ()=> {
    const burger = document.querySelector('.burger');
    const nav = document.querySelector('.nav-links');
    const navLinks=document.querySelectorAll('.nav-links li');
 //Toggle Nav
    
    burger.addEventListener('click', () =>{
        nav.classList.toggle('nav-active');

    navLinks.forEach((link,index) =>{
       if(link.style.animation) {
           link.style.animation=''
        } else {

            link.style.animation=`navLinkFade 0.5s ease forwards ${index /7 + 0.2}s`;
        }
        console.log(index / 7);
    });
		burger.classList.toggle('toggle');
 });
}

navSlide();


modified 17-Dec-19 15:03pm.

QuestionAttempted to register a view with an id already in use: 2 - EmberJs Pin
simpledeveloper10-Dec-19 14:29
Membersimpledeveloper10-Dec-19 14:29 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
Richard MacCutchan10-Dec-19 21:56
mveRichard MacCutchan10-Dec-19 21:56 
AnswerRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
F-ES Sitecore10-Dec-19 22:32
mveF-ES Sitecore10-Dec-19 22:32 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
simpledeveloper11-Dec-19 5:53
Membersimpledeveloper11-Dec-19 5:53 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
Natalie-9015-Dec-19 5:11
MemberNatalie-9015-Dec-19 5:11 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
jkirkerx11-Dec-19 12:23
professionaljkirkerx11-Dec-19 12:23 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
simpledeveloper12-Dec-19 6:22
Membersimpledeveloper12-Dec-19 6:22 
AnswerRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
Pete O'Hanlon12-Dec-19 0:02
subeditorPete O'Hanlon12-Dec-19 0:02 
GeneralRe: Attempted to register a view with an id already in use: 2 - EmberJs Pin
simpledeveloper12-Dec-19 6:26
Membersimpledeveloper12-Dec-19 6:26 
QuestionI need to add “Add new item” option in Select2 Pin
Shraddha_Patel3-Dec-19 17:32
MemberShraddha_Patel3-Dec-19 17:32 
AnswerRe: I need to add “Add new item” option in Select2 Pin
phil.o3-Dec-19 21:45
mvephil.o3-Dec-19 21:45 
SuggestionRe: I need to add “Add new item” option in Select2 Pin
ZurdoDev4-Dec-19 2:52
mveZurdoDev4-Dec-19 2:52 
AnswerRe: I need to add “Add new item” option in Select2 Pin
simpledeveloper10-Dec-19 14:26
Membersimpledeveloper10-Dec-19 14:26 
AnswerRe: I need to add “Add new item” option in Select2 Pin
Member 1469087415-Dec-19 23:13
MemberMember 1469087415-Dec-19 23:13 
QuestionHow to include random password in email text message Pin
freezers30-Nov-19 19:44
Memberfreezers30-Nov-19 19:44 
QuestionRe: How to include random password in email text message Pin
ZurdoDev3-Dec-19 8:00
mveZurdoDev3-Dec-19 8:00 
AnswerRe: How to include random password in email text message Pin
freezers4-Dec-19 6:42
Memberfreezers4-Dec-19 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.