Topic: Scrolling Navbar Class
ryanjerskine pro asked 6 years ago
Would it be possible to add an option to add the 'top-nav-collapse' or similar to the 'body' tag instead of the navbar tag? I think it makes sense to allow this since having the navbar smaller/larger can change how parts of the rest of the page look. Currently, I copied the @HostListener code and I'm manually applying the class but it would be awesome if this could be configured as a part of the navbar. This is the code I used to add it to the body tag:
@HostListener('document:scroll', ['$event']) onScroll() {
if (window.pageYOffset >120) {
this.renderer.addClass(document.body, 'top-nav-collapse');
}
else {
this.renderer.removeClass(document.body, 'top-nav-collapse');
}
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Resolved
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Tags
Damian Gemza staff commented 6 years ago
Dear ryanjerskine, Thanks for your report. I'm adding this to our nice-to-have list, and we'll think about implementing this in future. Best Regards, Damian