Product Delivery
Targeted Sales
Collicitudin vel metus scelerisque ante commodo.
In Progress25% Completed
Bottom navbar hide on page scroll
The hide on scroll option use to hide your fixed bottom navbar on page scroll.
The hide on scroll option use to hide your fixed top or bottom navbar on page scroll down, once you scroll up again it will be visible. In this page you can experience it.
Hideable navbar option is available for fixed navbar with static navigation only. Works in top and bottom positions, single and multiple navbars.
This table contains all classes related to the fixed top or bottom navbar with hide on scroll.
All these options can be set via following classes:
Classes | Description |
---|---|
.navbar-hide-on-scroll |
To set navbar hide on scroll you need to add .navbar-hide-on-scroll class in navbar <nav> tag. Refer HTML markup line no 7. |
.navbar-fixed-top |
To hide on scroll you need to set navbar fixed also, add fixed navbar in top .navbar-fixed-top class in navbar <nav> tag. Refer HTML markup line no 7. |
.navbar-fixed-bottom |
To hide on scroll you need to set navbar fixed also, add fixed navbar in bottom .navbar-fixed-bottom class in navbar <nav> tag. Refer HTML markup line no 7. |
This section contains HTML Markup to set navbar hide on scroll. This markup define where to add css classes to make navbar hide on scroll.
.navbar-hide-on-scroll
class to make navbar hide on scroll..navbar-fixed-top
or .navbar-fixed-bottom
class for adjusting navbar fixed on top.Robust has a ready to use starter kit, you can use this layout directly by using the navbar-hide-on-scroll-bottom.html
<!DOCTYPE html>
<html lang="en">
<head></head>
<body data-menu="vertical-menu" class="vertical-layout vertical-menu 2-column menu-expanded">
<!-- navbar-hide-on-scroll-->
<nav role="navigation" class="header-navbar navbar navbar-with-menu navbar-hide-on-scroll navbar-fixed-bottom navbar-dark navbar-shadow navbar-border">
...
</nav>
<!-- BEGIN Navigation-->
<div class="main-menu menu-dark menu-shadow">
...
</div>
<!-- END Navigation-->
<!-- BEGIN Content-->
<div class="content robust-content container-fluid">
<div class="content-wrapper">
<!-- content header-->
<div class="content-header row">
...
</div>
<!-- content header-->
<!-- content right-->
<div class="content-right">
...
</div>
<!-- content right-->
</div>
</div>
<!-- END Content-->
<!-- START FOOTER DARK-->
<footer class="footer footer-dark">
...
</footer>
<!-- START FOOTER DARK-->
</body>
</html>
Robust Admin use headroom.js to functionate navbar hide on scroll. You need to use the following headroom.js configurations code for customization. File robust.js has the following code for customization.
Headroom.js is a lightweight, high-performance JS widget (with no dependencies!) that allows you to react to the user's scroll. The header on this site is a living example, it slides out of view when scrolling down and slides back in when scrolling up.
Headroom.js can also accept an options object to alter the way it behaves. You can see the default options by inspecting Headroom.options. The structure of an options object is as follows:
{
// vertical offset in px before element is first unpinned
offset : 0,
// scroll tolerance in px before state changes
tolerance : 0,
// or you can specify tolerance individually for up/down scroll
tolerance : {
up : 5,
down : 0
},
// css classes to apply
classes : {
// when element is initialised
initial : "headroom",
// when scrolling up
pinned : "headroom--pinned",
// when scrolling down
unpinned : "headroom--unpinned",
// when above offset
top : "headroom--top",
// when below offset
notTop : "headroom--not-top",
// when at bottom of scroll area
bottom : "headroom--bottom",
// when not at bottom of scroll area
notBottom : "headroom--not-bottom"
},
// element to listen to scroll events on, defaults to `window`
scroller : someElement,
// callback when pinned, `this` is headroom object
onPin : function() {},
// callback when unpinned, `this` is headroom object
onUnpin : function() {},
// callback when above offset, `this` is headroom object
onTop : function() {},
// callback when below offset, `this` is headroom object
onNotTop : function() {},
// callback when at bottom of page, `this` is headroom object
onBottom : function() {},
// callback when moving away from bottom of page, `this` is headroom object
onNotBottom : function() {}
}
Options | Datatype | Description |
---|---|---|
offset |
Number | Vertical offset in px before element is first unpinned. |
tolerance |
Number | Scroll tolerance in px before state changes,or you can specify tolerance individually for up/down scroll. |
initial |
String | When element is initialised this class will be applied. |
pinned |
String | when scrolling up, this class will be applied. |
unpinned |
String | When scrolling down, this class will be applied. |
Top |
String | When above offset, this class will be applied. |
notTop |
String | When below offset, this class will be applied. |
bottom |
String | When at bottom of scroll area, this class will be applied. |
notBottom |
String | When not at bottom of scroll area, this class will be applied. |
scroller |
Element to listen to scroll events on, defaults to `window`. | |
onPin |
function | Callback when pinned, `this` is headroom object. |
onUnpin |
function | Callback when unpinned, `this` is headroom object. |
onTop |
function | Callback when above offset, `this` is headroom object. |
onNotTop |
function | Callback when below offset, `this` is headroom object. |
onBottom |
function | Callback when at bottom of page, `this` is headroom object. |
onNotBottom |
function | Callback when moving away from bottom of page, `this` is headroom object. |
In Robust Admin we have just used following headroom.js configurations options in js/code/robust.js
Top navbar position example:
// Top Navbars - Hide on Scroll
$(".navbar-hide-on-scroll.navbar-fixed-top").headroom({
"offset": 205,
"tolerance": 5,
"classes": {
// when element is initialised
initial : "headroom",
// when scrolling up
pinned : "headroom--pinned-top",
// when scrolling down
unpinned : "headroom--unpinned-top",
}
});
Bottom navbar position example:
// Bottom Navbars - Hide on Scroll
$(".navbar-hide-on-scroll.navbar-fixed-bottom").headroom({
"offset": 205,
"tolerance": 5,
"classes": {
// when element is initialised
initial : "headroom",
// when scrolling up
pinned : "headroom--pinned-bottom",
// when scrolling down
unpinned : "headroom--unpinned-bottom",
}
});
Robust Admin use JADE as template engine to generate pages and whole template quickly using node js, for getting start with JADE usage & template generating process please refer template documentation.
This table contains required JADE variables to generate fixed navbar layout.
Variable | Value | Description |
---|---|---|
headerCustom |
'navbar-hide-on-scroll' |
You need to add navbar hide on scroll class to headerCustom variable value as 'navbar-hide-on-scroll' in headerConfig block. |
headerCustom |
'navbar-fixed-top' |
You also need to add navbar fixed class to headerCustom variable value as 'navbar-fixed-top' for fixed top navbar in headerConfig block. |
headerCustom |
'navbar-fixed-bottom' |
You also need to add navbar fixed class to headerCustom variable value as 'navbar-fixed-bottom' fixed bottom navbar in headerConfig block. |
To set navbar hide on scroll on page or template, you need to use following JADE code.
headerConfig
block has a headerCustom
variable, it contains navbar specific classes in that you need to add navbar-hide-on-scroll
& navbar-fixed-top
or navbar-fixed-bottom
.content
block has content section html file included include ../contents/navbar-hide-on-scroll-bottom.html
, which can be customizable on page level.If you want to use this layout on page level you need to define it on page it self. This template has one example jade file for fixed navbar-hide-on-scroll-bottom.jade
, however you can use it on template level but it will generate whole template has a navbar hide on scroll class.
block pageVars
- var pageTitle = "Hide on Scroll Bottom"
- var pageSubTitle = "Bottom navbar hide on page scroll"
- var description = "The hide on scroll option use to hide your fixed bottom navbar on page scroll."
- var activeMenu = "navbar-hide-on-scroll-bottom"
extends template
block headerConfig
- var headerCustom = "navbar-fixed-bottom navbar-dark navbar-shadow navbar-border navbar-hide-on-scroll"
//- navbar-fixed-bottom or navbar-fixed-bottom class for fixed bottom navbar
block menuConfig
- var menuCustom = "menu-dark menu-shadow"
//- for static navigation notice that here we are not using menu-fixed class
append breadcrumbs
include ../includes/mixins
+breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Navbars"}, {name:"Hide on Scroll Bottom"}])
append page-header
include page-headers/breadcrumb-top
//- Include page content in page block
append content
include ../contents/navbar-hide-on-scroll-bottom.html
//- Page specific dependency
//------------------------------
//- Add custom page specific CSS
block pagecss
//- Add custom page specific JS
block pagejs