我發現了一個非常基本的模式窗口腳本,在包括iPad在內的所有瀏覽器上運行良好。但是,在iPad上,它將模式窗口定位在站點的頂部,因此如果用戶滾動到站點的底部,則無法向上滾動就看不到它。垂直居中模式窗口/ div在ipad上
我覺得這樣的事情可能會有所幫助:
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
if (navigator.userAgent.match(/iPad/i)) {
winH = winH + $(window).scrollTop();
}
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
但它不是在工作,它仍然定位在div不正確,也就是說。不在視口中。
任何建議非常感謝!
請參閱我的回答下面有關'position:fixed'的問題。 – circey 2011-12-31 06:35:18