工作這是我使用重新定位#nav DIV 在窗口的中間(垂直)功能不能得到一個jQuery的功能絕對-POS一個div爲iPhone
function RepositionNav(){
var windowHeight = $window.height(); //get the height of the window
var navHeight = $('#nav').height()/2;
var windowCenter = (windowHeight/2);
var newtop = windowCenter - navHeight;
$('#nav').css({"top": newtop}); //set the new top position of the navigation list
}
這是哪裏我重新定位,而窗口
$window.bind('scroll', function(){ //when the user is scrolling...
RepositionNav();
});
爲用戶向下滾動它工作正常,但在iphone沒有 ... 我的意思是,它消失在滾動? (停留在原來的位置,頂端)
任何想法爲什麼?
非常感謝
停留在頂部像個位置是固定的,如果你在它前面加上'的.css ({「職位」:「絕對」})'鏈接它然後工作? – 2011-05-18 22:31:22
好吧,我確實有它的位置:絕對在我的CSS樣式表中,但我會嘗試aswel! – 2011-05-18 22:40:00
嘗試在scroll-method中添加一個警報,看它是否被觸發。 – Alxandr 2011-05-18 22:42:54