2012-11-07 33 views
3

我有一個多頁的Jquerymobile 1.2文件。當我導航到需要滾動的頁面時,頁腳不再是固定的,而是在第一次滾動時跳轉。當我鬆開手指時,頁腳跳回原位。當我使用後續滾動在多頁文檔內的任何其他頁面上重複該過程時,不再發生此效果。Jquerymobile/Phonegap/iOS的頁腳導航欄不固定在第一次滾動

這裏是頁腳代碼 - 這是用於多頁文檔中的所有頁面(請注意,它鏈接到一對夫婦的外部文件以及):

<div data-role="footer" class="nav-rp" data-theme="a" data-position="fixed" data-id="myfooter"> 
    <div data-role="navbar" class="nav-rp" > 
     <ul> 
      <li><a rel="external" href="index.html#index" class="icon-index" data-icon="custom">Home</a></li> 
      <li><a rel="external" href="index.html#route-1" class="icon-route" data-icon="custom">Route</a></li> 
      <li><a rel="external" href="gallery.html" class="icon-gallery" data-icon="custom">Gallery</a></li> 
      <li><a href="businesses.html" rel="external" class="icon-business" data-icon="custom">Business</a></li> 
     </ul> 
    </div> 
</div> 

任何指導,將不勝感激。

回答

6

認爲我解決了我的問題 - 它與頂部的元視口標記有關。我包括高度=設備高度,這似乎是伎倆。

+2

這就是答案,請更具體地說使用

1

這裏有一些有趣的技巧來解決這個

$('body').animate({scrollTop: window.screen.availHeight}, 1, function(){ 
     $('body').animate({scrollTop: "0px"}, 1); 
    }) 

iOS中完全可以與任何固定的元素

0

這種情況與ios 5.11(運行在iPhone 3Gs的),ios 6.12(Runninig iPhone4上) ,ios 6.0.1(在iPhone 5上運行)。 我的應用程序正在運行Phonegap 2.3

這個問題不僅僅是jQueryMobile問題,而是一個css定位問題。 (或與css問題顯示的其他東西)

「固定」頁腳開始在第一個滾動上移動。在此之後,頁腳被固定。每當屏幕鍵盤彈出並且內容滾動時,頁腳又會鬆動。

@VoVaVc建議的答案解決了第一個滾動問題,但沒有解決鍵盤開卷問題。修復Studio4的聲明height=device-height對我的應用程序沒有任何作用。

HTML:

<div id="footernav"> 
      <div id="Button" class="navButton"> 
       <img class="naviImg" src="assets/icon.png"> 
       <span>###buttonTexts###</span> 
      </div> 
      <div id="secondButton" class="navButton"> 
       <img class="naviImg" src="assets/icon.png"> 
       <span>###buttonTexts###</span> 
      </div>     
    </div> 

而對容器內的CSS

#footernav { 
clear: both; 
position: fixed !important; 
left: 0; 
bottom: 0; 
width: 100%; 
height: 9%; 
-webkit-box-shadow:0 -3px 30px rgba(0, 0, 0, 0.65); 
box-shadow:0 -3px 30px rgba(0, 0, 0, 0.65); 
z-index: 9; 
} 

編輯:

我解決我的問題與所有黑客的母親:

所以。鍵盤混亂與固定頁腳。所以,當我得到屏幕鍵盤(在我的情況下,點擊文本輸入字段),我隱藏了錯誤位置的頁腳,當關閉鍵盤時,我再次顯示它。

有時候沒有時間尋求適當的解決方案。