diff --git a/_globalnav.html b/_globalnav.html index 921d613f..d5f87d13 100644 --- a/_globalnav.html +++ b/_globalnav.html @@ -89,13 +89,13 @@ -
- +
+
diff --git a/js/jQuery.fixHeaderFooter.js b/js/jQuery.fixHeaderFooter.js index 9844ae12..83b170b7 100644 --- a/js/jQuery.fixHeaderFooter.js +++ b/js/jQuery.fixHeaderFooter.js @@ -18,7 +18,7 @@ $.fn.fixHeaderFooter = function(options){ var o = $.extend({ transition: el.find('[data-headfoottransition]').attr('data-headfoottransition') || ['slidedown','slideup'], //also accepts a string, like 'fade'. All animations work, but fade and slidedown/up look best - overlayOnly: el.find('.ui-fullscreen').length + overlayOnly: el.find('.ui-fullscreen').length || el.is('[data-role="globalnav"]') },options); //add transition and theme types @@ -71,12 +71,13 @@ $.fixedToolbars = (function(){ var fromTop = $(window).scrollTop(), screenHeight = window.innerHeight, - thisHeight = thisel.parent().parent().height(), - thisTop = thisel.parent().parent().offset().top, + placeholder = thisel.parent().parent(), + thisHeight = placeholder.height(), + thisTop = placeholder.offset().top, thisIsHeader = thisel.is('.ui-header'); - + if(partialVisibilityOkay){ - return thisIsHeader ? (thisTop <= fromTop) : (thisTop + thisHeight > fromTop + screenHeight); + return thisIsHeader ? (thisTop <= fromTop) : (thisTop + thisHeight >= fromTop + screenHeight); } else { return thisIsHeader ? (thisTop + thisHeight <= fromTop) : (thisTop > fromTop + screenHeight); @@ -115,18 +116,23 @@ $.fixedToolbars = (function(){ var els = allToolbars(); return els.each(function(){ var el = $(this), + partiallyCropped = placeHolderOutofView(el, true), + outofView = placeHolderOutofView(el), overlayOnly = el.closest('.ui-headfoot-overlayonly').length; - //only animate if placeholder is out of view - if( placeHolderOutofView(el, true) ){ + + if( partiallyCropped || overlayOnly){ el.parent().addClass('ui-fixpos'); - if( placeHolderOutofView(el) ){ - el.addClass('in').animationComplete(function(){ - el.removeClass('in'); - }); - } } + + //only animate if placeholder is out of view + + if( outofView ){ + el.addClass('in').animationComplete(function(){ + el.removeClass('in'); + }); + } + if(overlayOnly){ - el.parent().addClass('ui-fixpos'); el.parent().parent().removeClass('ui-headfoot-hidden'); } el.trigger('setTop'); diff --git a/js/jQuery.globalnav.js b/js/jQuery.globalnav.js index 86566543..0c9cfc29 100755 --- a/js/jQuery.globalnav.js +++ b/js/jQuery.globalnav.js @@ -12,10 +12,10 @@ $.fn.globalnav = function(settings){ },settings); //wrap it with footer classes - var globalnav = $(this).wrap('
').parent().addClass(o.fixedAs == 'footer' ? 'ui-footer' : 'ui-header'); + var globalnav = $(this).wrapInner('
').children(0).addClass(o.fixedAs == 'footer' ? 'ui-footer' : 'ui-header'); //apply fixed footer markup to ui-footer - $(document).fixHeaderFooter(); + $(this).fixHeaderFooter(); //set up the nav tabs widths (currently evenly divided widths, to be improved later) var navtabs = globalnav.find('li'); diff --git a/js/jQuery.mobile.js b/js/jQuery.mobile.js index 50eef3fd..ff41b3de 100644 --- a/js/jQuery.mobile.js +++ b/js/jQuery.mobile.js @@ -255,7 +255,7 @@ //dom-ready $(function(){ //global nav - $('.ui-globalnav').globalnav(); + $('[data-role="globalnav"]').globalnav(); //mobilize all pages present mobilize($('.ui-page'));