Take-Notes | This is a project which help you to take note | Frontend Framework library
kandi X-RAY | Take-Notes Summary
kandi X-RAY | Take-Notes Summary
This is a project which help you to take note, made with React.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Take-Notes
Take-Notes Key Features
Take-Notes Examples and Code Snippets
Community Discussions
Trending Discussions on Take-Notes
QUESTION
When a user clicks the hamburger icon className='.landing-page-hamburger'
it takes two clicks to toggle the navigation className='landing-page-nav-links'
and I can't figure out why.
The display value for .landing-page-nav-links
is set to none
by default in the CSS.
Navigation bar is requiring two clicks to toggle the display
value
Would expect to only need one click
LandingPage.js ...ANSWER
Answered 2017-Oct-28 at 03:29This is happening because your external CSS is not setting a style
property on your element. The first click sets it to none
because it isn't there at all. Your second click will now work as expected.
To fix this, either set the style of .landing-page-hamburger
inline, or just toggle classes and let your external CSS handle it.
EDIT: The OP asks an excellent question. The .style
property refers to the element's CSSStyleDeclaration object. This is a HTMLElement interface that you are directly manipulating. Notice, when you inspect an element in your console, the CSSStyleDeclaration does not necessarily match what you see in the CSS you get from the style sheet. Also, note that the properties are JS-style camelCase; this illustrates that this is not a direct mapping, yet they both effect the element.
So my initial description of the property being not there at all isn't accurate. It's there, and it's set to the empty string, which is the default CSSStyleDeclaration. So you set it to "none" on the second click and all goes well from there. Your initial CSS declaration is working correctly, but not figuring into your if
statement because it's not referring to the same thing. Same effect, but you're interfacing with your element in a different way.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Take-Notes
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page