Did someone know how to fadeOut everything whit a button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Did someone know how to fadeOut everything whit a button?

I want to make that when you press a button everything fadeOut

8th Mar 2018, 3:52 AM
Octavio Aguayo
Octavio Aguayo - avatar
3 Answers
+ 7
Yes, write a class in CSS with opacity 0 then add it via Javascript to the target element. It should work fade that element. Check the below demo modify to your use case https://code.sololearn.com/WmTAs8Y8tzWX/?ref=app
8th Mar 2018, 4:52 AM
Lord Krishna
Lord Krishna - avatar
+ 3
I have added some comments that may help. if you don't understand them then read & learn about DOM(document object model), eventlisteners. Read this article to get familiar with DOM https://zellwk.com/blog/js-in-dom/ Read about event listeners from below resources https://www.w3schools.com/js/js_htmldom_eventlistener.asp https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener After reading them read the code(save it private) and ask for specific doubts if any.
9th Mar 2018, 8:15 AM
Lord Krishna
Lord Krishna - avatar
+ 1
Can You explain me how it works so i can implement it in my code
9th Mar 2018, 2:00 AM
Octavio Aguayo
Octavio Aguayo - avatar