工作这是我使用重新定位#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