Why javascript doesnt work for me??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why javascript doesnt work for me???

HTML <!DOCTYPE html> <html> <head> <title>ItsMyDoggo</title> <link rel="stylesheet" type="text/css" href="ItsMyDoggo.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <header> <div class="logo">ItsMyDoggo</div> <ul class="navbar"> <li><a href="#">HOME</a></li> <li><a href="#">ABOUT ME</a></li> <li><a href="#">SERVICES</a></li> <li><a href="#">PROJECTS</a></li> <li><a href="#">CONTACT</a></li> </ul> <div class="burger"> <div class="line1"></div> <div class="line2"></div> <div class="line3"></div> </div> </header> <script src="app.js"></script> </body> </html> CSS * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #FFF597; } header { width: 100%; height: 80px; background-color: #FF7373; display: flex; justify-content: space-around; line-height: 80px; } header .logo { font-size: 30px; font-weight: 900; font-family: monospace; text-transform: uppercase; color: #fff; } header ul { display: flex; justify-content: space-around; width: 50%; margin-left: 10%; } header ul li { list-style: none; } header ul li a { text-decoration: none; font-size: 20px; font-weight: 900; color: #fff; font-family: sans-serif; } .burger { margin-top: 24px; display: none; } .burger div { width: 25px; height: 3px; background-color: #FFF597; margin: 5px; } @media screen and (max-width: 1024px) { body { overflow-x: hidden; } .burger { display: block; } header ul { position: absolute; display: flex; flex-direction: column; align-items: center; width:50%; top: 79px; height: calc(100vh - 80px); background-color: #FF7373; right: 0; transform: translateX(100%); } .nav-active { transform: translateX(0%); } } Javascript const navSlide = () => { const burger = document.querySelector(".burger"); const navbar = document.querySelector(".navbar"); burger.addEventListener('cl

26th Jul 2019, 4:43 PM
Mister I
Mister I - avatar
9 Answers
+ 7
There is a simple and easy way to share the code from PC. Go to https://code.sololearn.com / Paste the code in your PC in that Editor and save it. After saving, you'll see a share button in the screen. Copy link and edit the question and paste link. I discovered this method myself!😊
26th Jul 2019, 8:50 PM
Sarthak
Sarthak - avatar
+ 4
if the error message is "cannot read property of null", window.onload = () => { ... your scripts. } https://www.sololearn.com/post/90825/?ref=app if the error is "const is not defined", it is your browser don't support ES6, update your browser. install the latest Chrome, open Developers Tool and see the console message.
27th Jul 2019, 3:56 AM
Gordon
Gordon - avatar
+ 2
Could you please link the code?
26th Jul 2019, 6:31 PM
Daniele Bonomi
Daniele Bonomi - avatar
+ 2
@Daniele Bonomi Its from PC
26th Jul 2019, 7:43 PM
Mister I
Mister I - avatar
+ 1
Muhammad Wasif defer????
27th Jul 2019, 5:42 PM
Mister I
Mister I - avatar
+ 1
Sarthak Pokharel check the Last code question(Js don't work) pls🙏
27th Jul 2019, 5:49 PM
Mister I
Mister I - avatar
+ 1
Daniele Bonomi Check It pls🙏🙏(Js Don't Work)
27th Jul 2019, 5:50 PM
Mister I
Mister I - avatar
+ 1
Gordon Can You pls Check It🙏🙏(Js Don't Work)
27th Jul 2019, 5:51 PM
Mister I
Mister I - avatar
+ 1
1. add code to question with insert button below https://www.sololearn.com/post/75089/?ref=app https://code.sololearn.com/WQriryoXNJcY/?ref=app /* 2. assign your addEventListener function as callback of load event of window. /* 3. wrong variable name , should be navbar */
28th Jul 2019, 1:16 AM
Gordon
Gordon - avatar