Create a Scroll-Activated Sticky Navigation with JavaScript!

  Рет қаралды 71,717

DesignCourse

DesignCourse

Күн бұрын

Пікірлер
@DesignCourse
@DesignCourse 3 жыл бұрын
How often do you all utilize a sticky nav/header in some way, shape or form?
@lassef3692
@lassef3692 3 жыл бұрын
-test-
@primalscream40
@primalscream40 3 жыл бұрын
I’ve taken both your courses on Scrimba. I learned a good bit more than just UI. It helped me with a better understanding of doing html and css.
@igortot01
@igortot01 3 жыл бұрын
I had a project with this kind of thing few weeks ago. It's nice to see your approach. :D
@frz_akbar
@frz_akbar 3 жыл бұрын
finally now i know how to do this
@nishanthdipali6838
@nishanthdipali6838 3 жыл бұрын
Same feeling
@Ree-rr1js
@Ree-rr1js 3 жыл бұрын
Indo?
@frz_akbar
@frz_akbar 3 жыл бұрын
@@Ree-rr1js yes 😅
@Ree-rr1js
@Ree-rr1js 3 жыл бұрын
Self taught atau kuliah bang?
@frz_akbar
@frz_akbar 3 жыл бұрын
@@Ree-rr1js ya kuliah ya otodidak, tapi lebih banyak dari organisasi sih daripada kuliahnya, sisanya otodidak
@MaxWeir
@MaxWeir 3 жыл бұрын
Would be nice to see you add comments in the logic as you go, it’s great for us to refer to it as your writing your code and it’s something I do in my code workflow
@TalisonBrendon
@TalisonBrendon Жыл бұрын
OMG, this is exactly what I needed
@pixeledcode
@pixeledcode 3 жыл бұрын
I was thinking about implementing this today and there it is in video!
@abdelrahmanabdullah2694
@abdelrahmanabdullah2694 2 жыл бұрын
Great tutorial. This video and a w3 tutorial really helped me. Thanks man.
@abenjamin13
@abenjamin13 3 жыл бұрын
Omg this is awesome thank you 🙏 Gary. I think I’m going attempt to integrate this into a angular component 👍
@pawekoaczynski4505
@pawekoaczynski4505 3 жыл бұрын
That's a nice feature, yet it's so easy to implement. I might use it in my next project EDIT: I did it yesterday in React. I also added a sidebar, which hides together with the navbar on scroll up Also, TIL that KZbin removes hearts on edited comments, which kinda makes sense, I guess
@chantingdroneflutes
@chantingdroneflutes 2 жыл бұрын
Haya, how did you do this in React, I'm trying to adjust the code Gary provides and am a bit stuck...
@bojanistvancic6237
@bojanistvancic6237 2 жыл бұрын
This is nice but what about the events that are non-stop triggering cause of the scrolling? I mean that will happen literaly on every page cause header is always there.
@ПРОГРЕСС-л4л
@ПРОГРЕСС-л4л 9 ай бұрын
I am also worried about it. Do you have any better ideas to achieve the same result without affecting the performance of the website?
@francescociulla
@francescociulla 3 жыл бұрын
Amazing video and audio. Damn man your hair has grown a lot xd!
@DesignCourse
@DesignCourse 3 жыл бұрын
Lollll. In 2 years it's going to be nuts!
@steveanderson7960
@steveanderson7960 3 жыл бұрын
Great stuff. It works on desktop, but when scrolling all the way back up on iOS, the menu disappears. iOS appears to sort of bounce off the top and does a small degree of scroll down when swishing all the way back up.
@steveanderson7960
@steveanderson7960 3 жыл бұрын
I added this and it works on iOS: if (currentScroll
@hanifakbari3675
@hanifakbari3675 2 жыл бұрын
@@steveanderson7960 this case same with me
@vatsalbansal135
@vatsalbansal135 3 жыл бұрын
@DesignCourse which vscode theme are you using? 😁
@bootifreshful
@bootifreshful 3 жыл бұрын
another great tutorial!
@abdulsalphan
@abdulsalphan 2 жыл бұрын
Works great, but when I tried to put it in a function and call the function to window.addeventlistener, the scroll-up class ain't getting added when scrolling up.
@shadat-hossain3500
@shadat-hossain3500 Жыл бұрын
It's a very nice topic I am really appreciate❤❤
@galickidigital
@galickidigital 3 жыл бұрын
Sweet and professional
@astudio4607
@astudio4607 3 жыл бұрын
I think it's possible to do that with Promise too... We can set current offsetY page in a variable then use .then to compare both of them. is'nt that?!
@venkataramireddypulikhanda6071
@venkataramireddypulikhanda6071 3 жыл бұрын
Useful content 👌👍👏
@Rdrudra99
@Rdrudra99 2 жыл бұрын
Thank You 🤩
@daniervaliev6370
@daniervaliev6370 3 жыл бұрын
Does anyone know how to have menu appear from the right side. The logo is by itself, and menu is by itself. On scroll down, logo will ease out of the screen to the left, and menu to dissapear on the right side, on scroll up, the logo will appear from the left, easing in, and same with the menu, but from the right side. does anyone know how I would be able to do that?
@erikslorenz
@erikslorenz 3 жыл бұрын
I like this lighting better than the pink. Couldn't see you
@surajchanda7992
@surajchanda7992 2 жыл бұрын
Which vs code theme you use?
@josephnetherland880
@josephnetherland880 3 жыл бұрын
I like your channel so I've decided to bombard it with comments.
@omaryassir5885
@omaryassir5885 3 жыл бұрын
Awesome stuff 👏 When is the next negative space live ?
@DesignCourse
@DesignCourse 3 жыл бұрын
Maybe this Friday or Saturday.
@chacataplan
@chacataplan 3 жыл бұрын
Thk!!!! Can you make tuto some reveal element?
@naraku3232
@naraku3232 3 жыл бұрын
i am impressed with your biceps haha
@prathameshkurade8595
@prathameshkurade8595 3 жыл бұрын
my nav toggle doesn't function properly after i integrated this navbar. can anyone help me out with this?
@Yair-Harel
@Yair-Harel 2 жыл бұрын
Thank you!!
@ashishmangla221
@ashishmangla221 3 жыл бұрын
Can we do this using intersection observer API ??
@JGuest777
@JGuest777 2 жыл бұрын
On mobile, IOS will hide the nav once scrolled to the top using this logic: to fix just wrap your if statements in another if statement where currentScroll > someOffset. ex: if (currentScroll > 140) { then add and remove the scroll-up & down classes }
@FurikuriYugi
@FurikuriYugi 3 жыл бұрын
So much win. 🏆
@maneeshrockx667
@maneeshrockx667 3 жыл бұрын
I guess using intersection observer api will make it more easy...
@bharat61020
@bharat61020 3 жыл бұрын
What is intersection observer api??
@afplaktape
@afplaktape 3 жыл бұрын
Is it also possible to do this with an offset of 50px before it disappears?
@DesignCourse
@DesignCourse 3 жыл бұрын
Yep. Need to wrap it in an if statement before you add the class that makes it disappear, I imagine.
@steveanderson7960
@steveanderson7960 3 жыл бұрын
@@DesignCourse Adding this worked for me: if (currentScroll
@asphaltking5870
@asphaltking5870 2 жыл бұрын
thanksss you so muuuuuuuuuuuch
@omkarp9943
@omkarp9943 2 жыл бұрын
Is this work with CSS? Because you did with SCSS!!
@AllenMarsam
@AllenMarsam 3 жыл бұрын
Thanks
@czerskip
@czerskip 3 жыл бұрын
It may look like fun, but it's a UX nightmare. just stick it and leave it there, having to scroll the other direction to reveal navigation is painful for the users.
@mujakapasa
@mujakapasa 3 жыл бұрын
Tell that to people that use screenreaders and where the website has no skip links. Then navs on scroll up are the only timesaver for them. + if the fixed sticky nav isn't designed properly it will distract from the main content. An UX nightmare is a hamburger navigation on desktops, but not a sticky on scroll up.
@czerskip
@czerskip 3 жыл бұрын
@@mujakapasa The screen readers have absolutely nothing to do with how the existing navigation is animated or displayed for regular browsers, no idea how you made that connection. Your second point makes even less sense: the designers botched their job, so we should introduce another UX problem on top of the poorly designed navigation? It's absurd, and unfortunately the way many websites are designed and developed, especially for large corporations.
@mauricioviera6
@mauricioviera6 2 жыл бұрын
LinkedIn and other big companies implement this nav behaviour. I guess they know a little bit more than you about what's useful to the users 🙂
@Ripred0219
@Ripred0219 2 жыл бұрын
Ig there is a cost for everything. Sure the user will need to scroll up slightly but in exchange they get a more immersive experience. By removing the nav bar it’s kind of like removing a distraction for the user to solely focus on the important content
@davidfitcher2953
@davidfitcher2953 3 жыл бұрын
What does that hair say?
@Uncaught_in_promise
@Uncaught_in_promise 3 жыл бұрын
@Garry Simon you look like Tom Hanks
@wibowomuhmmad
@wibowomuhmmad 3 жыл бұрын
const body = document.body; let lastScrool = 0; window.addEventListener("scroll", function(evt) { let current = window.scrollY; if(current > 0) { body.classList.add("hide-nav") } if(current < lastScrool) { body.classList.remove("hide-nav") } lastScrool = current; } // style.css header { position: fixed; top: 0; left: 0; z-index: 9; width: 100%; height: 70px; transition: all 300ms ease; } .hide-nav header { transform: translateY(-100%); } I found an easier way, inspired by this video
@franktielemans6624
@franktielemans6624 3 жыл бұрын
or use headroom.js (1.38Kb)
@giribhushanch1726
@giribhushanch1726 3 жыл бұрын
I think 1st like and comment are given by @DesginCourse
@mun3673
@mun3673 3 жыл бұрын
It's soooooooooooooooooooooo complicated😟😟😟
@giribhushanch1726
@giribhushanch1726 3 жыл бұрын
1st comment
@TheForgotten366
@TheForgotten366 2 жыл бұрын
i thought i was ricked rolled he looked like rick ashley
This Simple Trick Makes Your Website 83% Better Looking
10:57
Web Dev Simplified
Рет қаралды 400 М.
11 UX Tips for Successful Navigations (in 7 minutes!)
7:35
DesignCourse
Рет қаралды 38 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
9 Web Design Trends 2025 to Spruce Up Your Site
16:33
Showit
Рет қаралды 43 М.
Sticky Navbar on Scroll With CSS | Change Navbar Color on Scroll With Javascript
7:36
Fabio Musanni - Programming Channel
Рет қаралды 56 М.
Awesome Scrolling SVG Line Drawing - How they did it!
21:45
DesignCourse
Рет қаралды 269 М.
Learn CSS Flexbox in 20 Minutes (Course)
20:37
Coding2GO
Рет қаралды 311 М.
Make Awesome SVG Animations with CSS // 7 Useful Techniques
12:20
You Don't Need JavaScript For This - CSS ONLY Infinite Scroll
23:35
Slaying The Dragon
Рет қаралды 154 М.
Hide Navigation on Page Scroll || Framer Motion useMotionValueEvent
5:49
Create Crazy 3D Image Slider Effects Using CSS Only
14:07
Lun Dev
Рет қаралды 551 М.
Smooth Page Transitions With Javascript Tutorial
33:41
developedbyed
Рет қаралды 875 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН