From 52eb7784e55715fcc99f59e954be15e22f082ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Ujj-M=C3=A9sz=C3=A1ros?= Date: Sun, 27 Mar 2016 23:12:14 +0200 Subject: [PATCH] Fixing #25 --- bootstrap-autohidingnavbar.jquery.json | 2 +- bower.json | 2 +- dist/jquery.bootstrap-autohidingnavbar.js | 6 +++--- dist/jquery.bootstrap-autohidingnavbar.min.js | 4 ++-- package.json | 2 +- src/jquery.bootstrap-autohidingnavbar.js | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bootstrap-autohidingnavbar.jquery.json b/bootstrap-autohidingnavbar.jquery.json index 47f5264..58ae96e 100644 --- a/bootstrap-autohidingnavbar.jquery.json +++ b/bootstrap-autohidingnavbar.jquery.json @@ -7,7 +7,7 @@ "ui", "navigation" ], - "version": "1.0.4", + "version": "1.0.5", "author": { "name": "István Ujj-Mészáros", "url": "https://github.com/istvan-autohidingnavbar" diff --git a/bower.json b/bower.json index 6a80f70..fbc420b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-autohidingnavbar", - "version": "1.0.4", + "version": "1.0.5", "homepage": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/", "authors": [ { diff --git a/dist/jquery.bootstrap-autohidingnavbar.js b/dist/jquery.bootstrap-autohidingnavbar.js index 51934f6..2f3b799 100644 --- a/dist/jquery.bootstrap-autohidingnavbar.js +++ b/dist/jquery.bootstrap-autohidingnavbar.js @@ -1,5 +1,5 @@ /* - * Bootstrap Auto-Hiding Navbar - v1.0.4 + * Bootstrap Auto-Hiding Navbar - v1.0.5 * An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well. * http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/ * @@ -40,7 +40,7 @@ } autoHidingNavbar.element.addClass('navbar-hidden').animate({ - top: -autoHidingNavbar.element.height() + top: -1 * parseInt(autoHidingNavbar.element.css('height'), 10) }, { queue: false, duration: autoHidingNavbar.settings.animationDuration @@ -144,7 +144,7 @@ this.setHideOffset(this.settings.hideOffset); this.setAnimationDuration(this.settings.animationDuration); - _hideOffset = this.settings.hideOffset === 'auto' ? this.element.height() : this.settings.hideOffset; + _hideOffset = this.settings.hideOffset === 'auto' ? parseInt(this.element.css('height'), 10) : this.settings.hideOffset; bindEvents(this); return this.element; diff --git a/dist/jquery.bootstrap-autohidingnavbar.min.js b/dist/jquery.bootstrap-autohidingnavbar.min.js index 25af2df..748f7cc 100644 --- a/dist/jquery.bootstrap-autohidingnavbar.min.js +++ b/dist/jquery.bootstrap-autohidingnavbar.min.js @@ -1,9 +1,9 @@ /* - * Bootstrap Auto-Hiding Navbar - v1.0.4 + * Bootstrap Auto-Hiding Navbar - v1.0.5 * An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well. * http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/ * * Made by István Ujj-Mészáros * Under Apache License v2.0 License */ -!function(a,b,c,d){function e(b,c){this.element=a(b),this.settings=a.extend({},w,c),this._defaults=w,this._name=m,this.init()}function f(b){v&&(b.element.addClass("navbar-hidden").animate({top:-b.element.height()},{queue:!1,duration:b.settings.animationDuration}),a(".dropdown.open .dropdown-toggle",b.element).dropdown("toggle"),v=!1)}function g(a){v||(a.element.removeClass("navbar-hidden").animate({top:0},{queue:!1,duration:a.settings.animationDuration}),v=!0)}function h(a){var b=n.scrollTop(),c=b-t;if(t=b,0>c){if(v)return;(a.settings.showOnUpscroll||l>=b)&&g(a)}else if(c>0){if(!v)return void(a.settings.showOnBottom&&b+u===o.height()&&g(a));b>=l&&f(a)}}function i(a){a.settings.disableAutohide||(s=(new Date).getTime(),h(a))}function j(a){o.on("scroll."+m,function(){(new Date).getTime()-s>r?i(a):(clearTimeout(p),p=setTimeout(function(){i(a)},r))}),n.on("resize."+m,function(){clearTimeout(q),q=setTimeout(function(){u=n.height()},r)})}function k(){o.off("."+m),n.off("."+m)}var l,m="autoHidingNavbar",n=a(b),o=a(c),p=null,q=null,r=70,s=0,t=null,u=n.height(),v=!0,w={disableAutohide:!1,showOnUpscroll:!0,showOnBottom:!0,hideOffset:"auto",animationDuration:200};e.prototype={init:function(){return this.elements={navbar:this.element},this.setDisableAutohide(this.settings.disableAutohide),this.setShowOnUpscroll(this.settings.showOnUpscroll),this.setShowOnBottom(this.settings.showOnBottom),this.setHideOffset(this.settings.hideOffset),this.setAnimationDuration(this.settings.animationDuration),l="auto"===this.settings.hideOffset?this.element.height():this.settings.hideOffset,j(this),this.element},setDisableAutohide:function(a){return this.settings.disableAutohide=a,this.element},setShowOnUpscroll:function(a){return this.settings.showOnUpscroll=a,this.element},setShowOnBottom:function(a){return this.settings.showOnBottom=a,this.element},setHideOffset:function(a){return this.settings.hideOffset=a,this.element},setAnimationDuration:function(a){return this.settings.animationDuration=a,this.element},show:function(){return g(this),this.element},hide:function(){return f(this),this.element},destroy:function(){return k(this),g(this),a.data(this,"plugin_"+m,null),this.element}},a.fn[m]=function(b){var c=arguments;if(b===d||"object"==typeof b)return this.each(function(){a.data(this,"plugin_"+m)||a.data(this,"plugin_"+m,new e(this,b))});if("string"==typeof b&&"_"!==b[0]&&"init"!==b){var f;return this.each(function(){var d=a.data(this,"plugin_"+m);d instanceof e&&"function"==typeof d[b]&&(f=d[b].apply(d,Array.prototype.slice.call(c,1)))}),f!==d?f:this}}}(jQuery,window,document); \ No newline at end of file +!function(a,b,c,d){function e(b,c){this.element=a(b),this.settings=a.extend({},w,c),this._defaults=w,this._name=m,this.init()}function f(b){v&&(b.element.addClass("navbar-hidden").animate({top:-1*parseInt(b.element.css("height"),10)},{queue:!1,duration:b.settings.animationDuration}),a(".dropdown.open .dropdown-toggle",b.element).dropdown("toggle"),v=!1)}function g(a){v||(a.element.removeClass("navbar-hidden").animate({top:0},{queue:!1,duration:a.settings.animationDuration}),v=!0)}function h(a){var b=n.scrollTop(),c=b-t;if(t=b,0>c){if(v)return;(a.settings.showOnUpscroll||l>=b)&&g(a)}else if(c>0){if(!v)return void(a.settings.showOnBottom&&b+u===o.height()&&g(a));b>=l&&f(a)}}function i(a){a.settings.disableAutohide||(s=(new Date).getTime(),h(a))}function j(a){o.on("scroll."+m,function(){(new Date).getTime()-s>r?i(a):(clearTimeout(p),p=setTimeout(function(){i(a)},r))}),n.on("resize."+m,function(){clearTimeout(q),q=setTimeout(function(){u=n.height()},r)})}function k(){o.off("."+m),n.off("."+m)}var l,m="autoHidingNavbar",n=a(b),o=a(c),p=null,q=null,r=70,s=0,t=null,u=n.height(),v=!0,w={disableAutohide:!1,showOnUpscroll:!0,showOnBottom:!0,hideOffset:"auto",animationDuration:200};e.prototype={init:function(){return this.elements={navbar:this.element},this.setDisableAutohide(this.settings.disableAutohide),this.setShowOnUpscroll(this.settings.showOnUpscroll),this.setShowOnBottom(this.settings.showOnBottom),this.setHideOffset(this.settings.hideOffset),this.setAnimationDuration(this.settings.animationDuration),l="auto"===this.settings.hideOffset?parseInt(this.element.css("height"),10):this.settings.hideOffset,j(this),this.element},setDisableAutohide:function(a){return this.settings.disableAutohide=a,this.element},setShowOnUpscroll:function(a){return this.settings.showOnUpscroll=a,this.element},setShowOnBottom:function(a){return this.settings.showOnBottom=a,this.element},setHideOffset:function(a){return this.settings.hideOffset=a,this.element},setAnimationDuration:function(a){return this.settings.animationDuration=a,this.element},show:function(){return g(this),this.element},hide:function(){return f(this),this.element},destroy:function(){return k(this),g(this),a.data(this,"plugin_"+m,null),this.element}},a.fn[m]=function(b){var c=arguments;if(b===d||"object"==typeof b)return this.each(function(){a.data(this,"plugin_"+m)||a.data(this,"plugin_"+m,new e(this,b))});if("string"==typeof b&&"_"!==b[0]&&"init"!==b){var f;return this.each(function(){var d=a.data(this,"plugin_"+m);d instanceof e&&"function"==typeof d[b]&&(f=d[b].apply(d,Array.prototype.slice.call(c,1)))}),f!==d?f:this}}}(jQuery,window,document); \ No newline at end of file diff --git a/package.json b/package.json index 0ff7ea7..fdf6543 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "url": "http://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar.git" }, "homepage": "http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/", - "version": "1.0.4", + "version": "1.0.5", "devDependencies": { "grunt": "~0.4.1", "grunt-cli": "~0.1.13", diff --git a/src/jquery.bootstrap-autohidingnavbar.js b/src/jquery.bootstrap-autohidingnavbar.js index cef93b8..4a516c4 100644 --- a/src/jquery.bootstrap-autohidingnavbar.js +++ b/src/jquery.bootstrap-autohidingnavbar.js @@ -32,7 +32,7 @@ } autoHidingNavbar.element.addClass('navbar-hidden').animate({ - top: -autoHidingNavbar.element.height() + top: -1 * parseInt(autoHidingNavbar.element.css('height'), 10) }, { queue: false, duration: autoHidingNavbar.settings.animationDuration @@ -136,7 +136,7 @@ this.setHideOffset(this.settings.hideOffset); this.setAnimationDuration(this.settings.animationDuration); - _hideOffset = this.settings.hideOffset === 'auto' ? this.element.height() : this.settings.hideOffset; + _hideOffset = this.settings.hideOffset === 'auto' ? parseInt(this.element.css('height'), 10) : this.settings.hideOffset; bindEvents(this); return this.element;