From 83f6ff9eef9f1f46834dc867c3c04cb78cf8da5d Mon Sep 17 00:00:00 2001 From: scottjehl Date: Tue, 5 Oct 2010 16:08:11 -0400 Subject: [PATCH] added support for fullscreen data attr on pages. When present, child headers and footers will be absolute positioned and invisible when hidden --- css/jQuery.mobile.headerfooter.css | 4 ++-- js/jQuery.mobile.fixHeaderFooter.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/css/jQuery.mobile.headerfooter.css b/css/jQuery.mobile.headerfooter.css index 2a034ae7..face40eb 100644 --- a/css/jQuery.mobile.headerfooter.css +++ b/css/jQuery.mobile.headerfooter.css @@ -4,9 +4,9 @@ * Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. */ /* page header & footer configuration */ -.ui-header, .ui-footer { position: absolute; z-index: 1000; overflow: hidden; width: 100%; } +.ui-header, .ui-footer, .ui-page-fullscreen .ui-header, .ui-page-fullscreen .ui-footer { position: absolute; z-index: 1000; overflow: hidden; width: 100%; } .ui-page .ui-header, .ui-page .ui-footer { position: relative; } -.ui-footer-duplicate { display: none; } +.ui-footer-duplicate, .ui-page-fullscreen .ui-fixed-inline { display: none; } .ui-header .ui-back { position: absolute; left: 10px; top: .4em; } .ui-header h1, .ui-footer h1 { text-align: center; font-size: 16px; display: block; margin: .6em 90px .8em; padding: 0; white-space: nowrap; overflow: hidden; } .ui-header .ui-aux { position: absolute; right: 10px; top: .2em; } diff --git a/js/jQuery.mobile.fixHeaderFooter.js b/js/jQuery.mobile.fixHeaderFooter.js index c75b1a25..c8eae23a 100644 --- a/js/jQuery.mobile.fixHeaderFooter.js +++ b/js/jQuery.mobile.fixHeaderFooter.js @@ -7,8 +7,9 @@ (function($){ $.fn.fixHeaderFooter = function(options){ return $(this).each(function(){ - $(this).find('.ui-header').addClass('ui-header-fixed fade'); //should be slidedown - $(this).find('.ui-footer').addClass('ui-footer-fixed fade'); //should be slideup + if( $(this).data('fullscreen') ){ $(this).addClass('ui-page-fullscreen'); } + $(this).find('.ui-header').addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown + $(this).find('.ui-footer').addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup }); }; @@ -106,6 +107,9 @@ $.fixedToolbars = (function(){ screenHeight = window.innerHeight, thisHeight = el.outerHeight(), alreadyVisible = (el.is('.ui-header-fixed') && fromTop <= thisTop + thisHeight) || (el.is('.ui-footer-fixed') && thisTop <= fromTop + screenHeight); + + //add state class + el.addClass('ui-fixed-overlay').removeClass('ui-fixed-inline'); if( !alreadyVisible && !immediately ){ el.addClass('in').animationComplete(function(){ @@ -119,6 +123,10 @@ $.fixedToolbars = (function(){ currentstate = 'inline'; return $('.ui-header-fixed,.ui-footer-fixed:not(.ui-footer-duplicate)').each(function(){ var el = $(this); + + //add state class + el.addClass('ui-fixed-inline').removeClass('ui-fixed-overlay'); + if(immediately){ el.css('top',0); }