2014-10-09 82 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