Browse files

Fixed 59 - Fixed footer is anchored to the end of the page content in…

…stead of the view port.

- If content is less than the view port height, the footer is always anchored at the bottom of the view port.
- If the content is greater in height than the view port, then in inline mode itrests in flow, and in "fixed" mode it snaps to the bottom of the view port.
  • Loading branch information...
1 parent 058f0a8 commit a77ca291e69eaafa3530191c1ed13fa6a6a7e107 @jblas jblas committed Nov 11, 2010
Showing with 16 additions and 11 deletions.
  1. +16 −11 js/jquery.mobile.fixHeaderFooter.js
View
27 js/jquery.mobile.fixHeaderFooter.js
@@ -130,7 +130,7 @@ $.fixedToolbars = (function(){
else{
//relval = -1 * (thisTop - (fromTop + screenHeight) + thisCSStop + thisHeight);
//if( relval > thisTop ){ relval = 0; }
- relval = fromTop + screenHeight - thisHeight - thisTop;
+ relval = fromTop + screenHeight - thisHeight - (thisTop - thisCSStop);
return el.css('top', ( useRelative ) ? relval : fromTop + screenHeight - thisHeight );
}
}
@@ -164,20 +164,25 @@ $.fixedToolbars = (function(){
var $ap = $.mobile.activePage ? $.mobile.activePage : $(".ui-page-active");
return $ap.children( toolbarSelector ).each(function(){
var el = $(this);
+
+ var thisCSStop = el.css('top'); thisCSStop = thisCSStop == 'auto' ? 0 : parseFloat(thisCSStop);
//add state class
el.addClass('ui-fixed-inline').removeClass('ui-fixed-overlay');
- if(immediately){
- el.css('top',0);
- }
- else{
- if( el.css('top') !== 'auto' && parseFloat(el.css('top')) !== 0 ){
- var classes = 'out reverse';
- el.addClass(classes).animationComplete(function(){
- el.removeClass(classes);
- el.css('top',0);
- });
+ if (thisCSStop < 0 || (el.is('.ui-header-fixed') && thisCSStop != 0))
+ {
+ if(immediately){
+ el.css('top',0);
+ }
+ else{
+ if( el.css('top') !== 'auto' && parseFloat(el.css('top')) !== 0 ){
+ var classes = 'out reverse';
+ el.addClass(classes).animationComplete(function(){
+ el.removeClass(classes);
+ el.css('top',0);
+ });
+ }
}
}
});

0 comments on commit a77ca29

Please sign in to comment.