Great tutorial man! What I did take make it a little easier to maintain is instead of selecting all the li, I selected every "a" tag and got its href attribute then did a substring to remove the "#". Then i checked that against the "current" variable. that way you don't have to add classes to each li. const navLi = document.querySelectorAll('.tabs__item a'); navLi.forEach(li => { li.classList.remove('active'); const href = li.getAttribute('href').substring(1); if (href === current) { li.classList.add('active'); } });
@webcifar3 жыл бұрын
Great 👍
@Matin1999_unique3 жыл бұрын
this tutorial is just perfect and what programmers are looking for. 👍
@AjSarco3 жыл бұрын
life saver tutorial , thanks man, I've been struggling how to highlight section on navbar, I'm almost done with my project and this is the only thing I'm stuck with.
@MrTomequ3 жыл бұрын
Cool video, thanks. Small suggestion. If you set the value of current on 'home' (current = 'home') instead an empty string, than you'll have button-background on Home at the beginning and when you click again Home as well. Gr.
@webcifar3 жыл бұрын
That’s great 👍
@gaurishnaik82882 жыл бұрын
Thankyou this helped ne
@skullnecroze Жыл бұрын
The best tutorial about this on the web. Thanks very much for share this with us!
@gabrielfono8442 жыл бұрын
Thanks so much sir I brought the same logic into the startup I am currently building with React. I used useRef instead and everything is smooth. thanks again have a wonderful day and your family love from Seattle Washington
@tusharkadian3 жыл бұрын
It is better to add class on tag instead of ?
@ichigolei46372 жыл бұрын
Just what I needed! I made minimalist navigation side bar, just lines to redirect my five sections, and was wondering how to change the background color when passing each section. thank you so much
@kunalpatil12502 жыл бұрын
thanks man i implemented this in react
@photoinshot13559 ай бұрын
Brilliant tutorial, very helpful and very well explained and demonstrated, great code, great teacher, thanks!
@esmailkhalifa39843 жыл бұрын
I have been looking for it for three days😶 Finally ❤️🙂
@webcifar3 жыл бұрын
♥
@MrWebDesignerAnas3 жыл бұрын
thank you sir it was really helpful
@webcifar3 жыл бұрын
Glad it helped
@freddymoreno93002 жыл бұрын
Great Great Great TUTORIAL! simple, concise, and intereting. Thank you! keep doing great stuff
@rosehope53762 жыл бұрын
Thank you really it was a good one ..
@webcifar2 жыл бұрын
Glad you liked it!
@simond.7448 Жыл бұрын
Thank you very much for this quick guide! It's awesome.
@photoinshot13552 жыл бұрын
Excellent video, brilliant tutor, he explains things really well, clear well presented video, thanks!
@nimi_nomo Жыл бұрын
Thanks so much. Helped a lot
@alphamx1310 ай бұрын
Great tutorial, thank you!
@kese11353 жыл бұрын
Thank you so much! You're the best!
@webcifar3 жыл бұрын
You are welcome ❤️
@abdulraffy5398 Жыл бұрын
Nailed It!
@alexkelso16493 жыл бұрын
thanks so much legend. Learned so much watching this.
@guilhermehammes15163 жыл бұрын
simple and functional! thanks for the great video
@webcifar3 жыл бұрын
Thanks
@havefun551911 ай бұрын
Thanks, this is what I want
@noahdwhitney11 ай бұрын
Be careful. You are adding a scroll listener, which fires a ton even on a short distance scroll. Every time the scroll event is fired you are iterating through a list of elements. This method could be extremely expensive. You should include logic in event listener callback to throttle how many times the iteration is done.
@istiakahammad70743 жыл бұрын
Finally i got it. Thanks
@tinghuang32182 жыл бұрын
Great tutorial! This is perfect and helps me a lot. Thank you so much👍
@romuloalves93493 жыл бұрын
Ótimo vídeo parabéns 👏.
@webcifar3 жыл бұрын
Obrigado
@andreydario263 жыл бұрын
puta video
@kennyakins35363 жыл бұрын
This really helped a lot 👏
@webcifar3 жыл бұрын
Glad it was helpful.
@chaipiyo3 жыл бұрын
thank you so much brother .. very well explained
@lanhphalla1623 Жыл бұрын
Very good video. Can you create the video of this in small screen and move navbar by base on scroll?
@thanhannguyen25652 жыл бұрын
It is extremely easy to understand.
@selsen9011 Жыл бұрын
i have the problem that my sectiontop does not show, when i type "console.log". my Sections are all diffrent in height. the console.log on sections worked, so it knows where the sections are, but cant figure the offsetTop out.. Do you know why that is?
@ankitkumarravidas60622 жыл бұрын
yu are my life save bro thanks
@mwmersal2 жыл бұрын
Wooooow! this was unbelievably helpful mate. Thanks ^^
@webcifar2 жыл бұрын
Glad to hear it!
@richardshaju Жыл бұрын
Thank you so much 💝🥰
@patricioscida39493 жыл бұрын
Great video, thank you so much.
@webcifar3 жыл бұрын
You're very welcome!
@user-gw3yd8ev6p2 жыл бұрын
Thanks for tutorial, it's very useful!
@raomudasir45093 жыл бұрын
really awesome bro
@ogunkayodeoluwaseun93482 жыл бұрын
What would happen if the nav li's had multiple sub-links ??? @WEB CIFAR
@tszpang99173 жыл бұрын
Thanks for the tutorial! Worked for my project :D
@webcifar3 жыл бұрын
Glad it helped!
@liluo77903 жыл бұрын
thank you so much ! thank you so much man
@webcifar3 жыл бұрын
You're welcome!
@valeriyadolya84123 жыл бұрын
Thank you very much, it helped me a lot!
@guxsta32172 жыл бұрын
Thank you so much!! Amazing video
@senju312 жыл бұрын
I'm not seeing the footer in console.log. I see the home and about section but not the footer.
@imranhossainbpp2 жыл бұрын
What if i want to add class in the nav while scrolling in a particular section ? Love from @Bangladesh
@ThisIsAhn3 жыл бұрын
ধন্যবাদ ভাই
@sandeepsv35143 жыл бұрын
thanks thank you so much for the video it means a lot
@webcifar3 жыл бұрын
Glad it helped
@ryukagai3 жыл бұрын
Exactly what I needed! Thank you :)
@webcifar3 жыл бұрын
Glad it helped!
@selah_22152 жыл бұрын
Thank you very much! Your tutorial helped me a lot. At first I was kinda struggling troubleshooting, but it was the most fun part. It was worth it. ;> Really really thank u 🙏
@webcifar2 жыл бұрын
Glad it helped!
@ujjalzaman27222 жыл бұрын
thank you so much for this one.
@webcifar2 жыл бұрын
You're very welcome!
@paalaleksander2 жыл бұрын
Thanks for this! Helped me a lot!
@webcifar2 жыл бұрын
Glad it helped!
@jmcoxD Жыл бұрын
Excellent tutorial!
@shaaa003 жыл бұрын
Thank you for sharing this tutorial, it really helped me
@webcifar3 жыл бұрын
Glad to hear that!
@ankitraj5ar3 жыл бұрын
very useful !!!!!!
@nadirmohamed82743 жыл бұрын
You are the best bro
@webcifar3 жыл бұрын
Thanks
@SamFourieOfficial2 жыл бұрын
My sections variable just has an empty list, so it does not pick up the sections.
@thangphan60472 жыл бұрын
Thank you so much :)
@gabrielfono8442 жыл бұрын
sir I would love to start a youtube channel could you tell with software you are using to record a course and which software you use to edit. also which microphone and camera you are using I really love creating content that is why I am building an application to share my content
@webcifar2 жыл бұрын
That's awesome. I use OBS to record, DaVinci Resolve to edit and for the microphone I use BM800. For now, everything is working fine for me with this setup.
@gabrielfono8442 жыл бұрын
@@webcifar thanks a lot 🙏
@__-qp9dl3 жыл бұрын
당신은 천재입니다. 감사합니다 !
@giovannimichel55062 жыл бұрын
Thank you for the intel
@sairaghava61113 жыл бұрын
This implementation is breaking when I change the screen resolution, can you help here
@_4zad2 жыл бұрын
Great vid, learned a lot!
@dustinbest13262 жыл бұрын
Nice video! Thank you!
@siawonderswhy3 жыл бұрын
very helpful thank you
@webcifar3 жыл бұрын
Glad it was helpful!
@Rystaal2 жыл бұрын
Don't work for me if section's height is in %... any advice to fix this issue?
@shas36262 жыл бұрын
Great video..had a question i am getting my section.OffsetTop as undefined.Can you help me with this?
@duvvadasaibhargav98792 жыл бұрын
Thanks for your tutorial learned a lot
@webcifar2 жыл бұрын
Glad to hear that!
@harshilparmar90762 жыл бұрын
Thanks bro!!
@vishnuk96282 жыл бұрын
how to keep the selected nav color the same even after refreshing the page
@dibanpitchaimuthu93363 жыл бұрын
Great vid, just one error I noticed you forgotten 's' at 10:04 for transition
@LordzChilight3 жыл бұрын
thank you, learn a lot :D 🙏
@alamineuropeanit5833 жыл бұрын
thanks. I like this tips
@ranadebnath54213 жыл бұрын
thanku so much bhai ...
@webcifar3 жыл бұрын
Welcome Bhai ♥
@eddi3ms3 жыл бұрын
very helpfull, thanks alot !!
@webnirbhar7852 жыл бұрын
How to open collapse data when scroll down in js Please help
@a.j91573 жыл бұрын
Great video man keep up !
@webcifar3 жыл бұрын
Thanks, you too!
@victory_lucky3 жыл бұрын
nice, but please zoom in a little bit when recording, watching on mobile is quite difficult.
@webcifar3 жыл бұрын
Noted. ❤
@tiendang51492 жыл бұрын
Very good , thank you!
@webcifar2 жыл бұрын
Our pleasure!
@MohamedMedhat-ic5ng3 жыл бұрын
thank you
@ahmadyamout68672 жыл бұрын
Hello dear .Your code is not working because Pageyoffset is deprecated what is it's alternative please ?
@nadirmemmedov60713 жыл бұрын
good
@webcifar3 жыл бұрын
Thanks
@MuhammadRizky-ub3oy Жыл бұрын
why is my home offsetTop returning 0?
@osman11102 жыл бұрын
hi how would you make it diff colours for each section?
@samarjamil30533 жыл бұрын
Awesome Bro! ❤️
@webcifar3 жыл бұрын
Thanks 🔥
@tomo_38832 жыл бұрын
Vsc theme?
@PreejalRatnaSilakar2 жыл бұрын
helpful
@webcifar2 жыл бұрын
Glad it helped
@omarakki7053 жыл бұрын
Thank you my brother
@webcifar3 жыл бұрын
You are welcome
@omarakki7053 жыл бұрын
@@webcifar do you have a tutorial in javascript
@entertainmenthut88962 жыл бұрын
Your tutorial does not work for me. I am using sublime 3.
@TommyTips3 жыл бұрын
It's cool ;)
@webcifar3 жыл бұрын
🤟
@AzulCieloBlue3 жыл бұрын
When I scroll to the bottom the last section is not beign detected. help please! Cool and really helpful video btw
@mariyanesvyetaylo62642 жыл бұрын
Hello, thank you so much for this video - very helpful! I wonder if you can help me : I want to add .scrollIntoView({ behavior: 'smooth', inline: "start" }) when clicked on nav item(so the correspondant section scrolls smoothly into view), but can't figure out how to get the "section" id to match li class.. navLi.forEach((li) => { li.classList.remove("active"); if (li.classList.contains(current)) { li.classList.add("active"); } li.addEventListener("click", () => { let liClass = li.getAttribute("class") ???????????? }) }); sorry if this is confusing >_>
@Sebeklis3 жыл бұрын
There are tons of problems with routing etc.
@zayednation3692 Жыл бұрын
bro, can u do it for react js?
@hugoshaco81493 жыл бұрын
When you are on home and click to footer: the animation ("active" so the red bg) is visible on all other nav button during the autoscroll idk if someone know what i mean :D also thx for this video
@senju312 жыл бұрын
There's a KZbinr by the name of Bedimcode that implemented this feature in this video kzbin.info/www/bejne/bJTMlZWLfbONiLM but he did it differently from yours. I think yours was quicker to grasp because you explained what you were doing but he doesn't speak in his videos. I actually was able to break it down by watching your video and further reading and testing on my part. I may make a KZbin video on it , explaining how Bedimcode made his own work
@aminzorriyeh27823 жыл бұрын
how can i get this cod
@harshjha2712 жыл бұрын
Please explain properly i did'nt understand the logic in (if condtion) if anyone understand please explain this logic to me