我正在一個網站上工作,我必須使用固定的DIV作爲菜單。 www.atelier2architecten.nl/index2.php當窗口太小時,用JavaScript進行固定div滾動。 DOC TYPE問題
我試圖找到一種方法讓固定的div滾動水平。 因爲,當je使瀏覽器窗口變小時,您無法單擊te窗口外的按鈕。
我發現了一些jquery解決方案。但那些包括動畫。我的客戶不希望這樣。它必須保持固定。
我也在這個網站上找到了一個很好的解決方案但是當我在我的代碼中使用一個DOC類型時,它並沒有工作。 (我需要爲我的CSS)
這就是好好嘗試一下工作與任何文檔類型的代碼:我希望有人能幫助我這個
function hscrollbar() {
var left =
/* window.pageXOffset should work for most recent browsers: */
window.pageXOffset ? window.pageXOffset :
/* If it DOESN'T, let's try this: */
document.documentElement.scrollLeft ? document.documentElement.scrollLeft :
/* And if THAT didn't work: */
document.body.scrollLeft;
/* Now that we have the horizontal scroll position, set #footpanel's left
position to NEGATIVE the value, so it APPEARS to follow the scroll: */
document.getElementById('menu').style.left = -left;
}
window.onscroll = hscrollbar; /* Call the function when the user scrolls */
window.onresize = hscrollbar; /* Call the function when the window resizes */
。當我不使用DOC類型時,它可以在谷歌瀏覽器上完美工作。但IE一如既往就是問題所在。
問候托比亞斯
爲什麼不調整窗口更窄時ATELIER前面的空間? – mplungjan 2012-04-07 13:04:29