2011-11-01 93 views
1

我试图在隐藏元素后重新定位jQuery Mobile中的固定页脚。

我已经做了相当多的搜索和它似乎是,如果我用

$ .mobile.fixedToolbars.show()

那么就应该尝试重新定位一切(according to this anyway)。

我试过了很多方法,包括$(window).resize和$ .updateLayout,但是页脚仍然没有重新定位。

有人有解决方案吗?小提琴可在这里:http://jsfiddle.net/YZRj2/2/

+0

您可以加入与http://jsfiddle.net/工作的例子吗? –

+0

小提琴添加:http://jsfiddle.net/YZRj2/2/ – Ger

回答

1

首先jQM不需要document.ready()所以删除它。上布局事件

文档(UpdateLayout请)

直播示例:

JS:

$('#no_thanks').tap(function() { 
    $('#earn_more').slideUp(function() { 
     $(this).trigger('updatelayout'); 
    }); 
}); 

HTML:

<div data-role="page" id="home" class="main_content"> 
    <div data-theme="b" data-role="header" role="banner"> 
     <h1 class="ui-title">My app</h1> 
    </div> 
    <div data-role="content"> 
     <p class="app_notice" id="earn_more">          
      Tell us more about yourself 

       <a href="#" data-role="button" data-theme="d" data-icon="delete" data-iconpos="right" id="no_thanks">No thanks</a> 
     </p> 

    </div> 
    <div data-role="footer" data-theme="c" data-position="fixed" class="footer"> 
     <div data-role="navbar"> 
      <ul> 
       <li><a href="#" class="ui-btn-active">Home</a></li>      
      </ul> 
     </div> 
    </div> 
</div>