Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the hidden navbar transparent #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/jquery.bootstrap-autohidingnavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
showOnUpscroll: true,
showOnBottom: true,
hideOffset: 'auto', // "auto" means the navbar height
animationDuration: 200
animationDuration: 200,
makeTransparent: false
};

function AutoHidingNavbar(element, options) {
Expand All @@ -32,7 +33,8 @@
}

autoHidingNavbar.element.addClass('navbar-hidden').animate({
top: -autoHidingNavbar.element.height()
top: -autoHidingNavbar.element.height(),
opacity: _finalOpacity
}, {
queue: false,
duration: autoHidingNavbar.settings.animationDuration
Expand All @@ -49,7 +51,8 @@
}

autoHidingNavbar.element.removeClass('navbar-hidden').animate({
top: 0
top: 0,
opacity: _initialOpacity
}, {
queue: false,
duration: autoHidingNavbar.settings.animationDuration
Expand Down Expand Up @@ -135,8 +138,11 @@
this.setShowOnBottom(this.settings.showOnBottom);
this.setHideOffset(this.settings.hideOffset);
this.setAnimationDuration(this.settings.animationDuration);
this.setMakeTransparent(this.settings.makeTransparent);

_hideOffset = this.settings.hideOffset === 'auto' ? this.element.height() : this.settings.hideOffset;
_initialOpacity = this.element.css('opacity');
_finalOpacity = this.settings.makeTransparent === true ? 0 : _initialOpacity;
bindEvents(this);

return this.element;
Expand All @@ -161,6 +167,10 @@
this.settings.animationDuration = value;
return this.element;
},
setMakeTransparent: function(value) {
this.settings.makeTransparent = value;
return this.element;
},
show: function() {
show(this);
return this.element;
Expand Down