Design comparison
Solution retrospective
My 2nd attempt at this project, I think it works well for both mobile and desktop. Any advice or suggestions on my css or react code is welcome.
Community feedback
- Account deleted
Hi,
It shouldn't be hard to add the functionality either with react.js or vanilla javascript.
- The easiest way would be to create the pop-up in html and css, and initialise it to have a property of
display : none
. Then give it a class, for example.popUp.active{ display: block/flex/grid }
or whatever you want it the display property to be.
- Then hook it up with javascript by adding an listener to the button;
-
first thing you have to do is to get the button and store in a variable; like this
let button = document.querySelector('in here it'll be the class/id of the button')
. -
Then it'll be
button.addEventListener('click', () => { document.querySelector('.popUp).classList.toggle('active')})
- Once you get the hang of it it's quite easy. You can check out this link https://www.w3schools.com/jsref/met_document_addeventlistener.asp
1@Charlie025xPosted about 3 years ago@thulanigamtee thanks for the tips! However, already having my code in react, I was determined to get my solution working using react. After plenty of research and trial, I Eventually got the site running :)
0 - The easiest way would be to create the pop-up in html and css, and initialise it to have a property of
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord