2014-10-09 24 views

回答

2

在保存所有頁面代碼的正文下創建一個div。給這個CSS的div:

position:absolute; 
top:0px; 
bottom:0px; 
right:0px; 
left:0px; 
overflow: scroll; 

然後只是在div上應用完美的滾動條。


一點解釋:

// Set the div's position 
position:absolute; // Set the div display to be relative to the document 

// Make the div cover the full page 
// by setting all directions px to 0 
top:0px;   // Set the div start from top 
bottom:0px;  // Set the div start from bottom 
right:0px;   // Set the div start from right 
left:0px;   // Set the div start from left 

// Set the div to show a scrollbar on overflow 
overflow: scroll; 
+0

工作,但滾動鏈接不工作,任何解決? – 2014-10-09 23:09:24

+0

我不知道,對不起。 – GramThanos 2014-10-09 23:11:58

+0

@ViruZX你是什麼意思的「滾動鏈接」?通過哈希#滾動到元素? – Gromo 2014-10-10 11:11:41