From 19e726f4309cc440ae0a7b44661bb835807e9aec Mon Sep 17 00:00:00 2001 From: zurbchris Date: Thu, 14 Mar 2013 14:38:15 -0700 Subject: [PATCH] updating topbar fixed bug --- js/foundation/foundation.topbar.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/js/foundation/foundation.topbar.js b/js/foundation/foundation.topbar.js index e39f9e6d2..519cbeeb9 100644 --- a/js/foundation/foundation.topbar.js +++ b/js/foundation/foundation.topbar.js @@ -82,11 +82,6 @@ section.find('li.moved').removeClass('moved'); topbar.data('index', 0); } - - if (topbar.parent().hasClass('fixed')) { - topbar.parent().toggleClass('fixed'); - $('body').css('padding-top', 0); - } }) .on('click.fndtn.topbar', '.top-bar .has-dropdown>a', function (e) { @@ -172,6 +167,9 @@ // check for sticky this.sticky(); + + // check for fixed + this.fixed(); }, largestUL : function () { @@ -213,7 +211,16 @@ }, fixed : function() { - + if (topbar.parent().hasClass('fixed')) { + var offst = this.outerHeight($('nav.top-bar'))+20; + topbar.parent().toggleClass('fixed'); + $('body').css('padding-top', 0); + window.scrollTo(0); + } + else { + topbar.parent().toggleClass('fixed'); + $('body').css('padding-top',offst); + } }, off : function () { -- 2.47.3