If you are utilizing AngularJS along with Angular Bootstrap, you can achieve a sleek design by following the steps below: Visit angular-ui.github.io/bootstrap for more information.
To implement this effectively:
HTML:
<nav id="header-navbar" class="navbar navbar-default" ng-class="{'navbar-fixed-top':scrollDown}" role="navigation" scroll-nav>
<div class="container-fluid top-header">
<!--- Additional code here --->
</div>
</nav>
CSS: (Note: Padding is used to create a collapsible navigation bar. Modify as needed)
nav.navbar {
-webkit-transition: all 0.4s ease;
transition: all 0.4s ease;
background-color: white;
margin-bottom: 0;
padding: 25px;
}
.navbar-fixed-top {
padding: 0;
}
Add the directive below:
Directive: (Note: Adjust this.pageYOffset >= 50
value based on your requirements)
angular.module('app')
.directive('scrollNav', function ($window) {
return function(scope, element, attrs) {
angular.element($window).bind("scroll", function() {
if (this.pageYOffset >= 50) {
scope.scrollDown = true;
} else {
scope.scrollDown = false;
}
scope.$apply();
});
};
});
This approach will provide a visually appealing and animated effect to your website's navigation.