2012-12-14 102 views
0

我正在尋找一個示例來創建一個頁面,頁面向下滾動時將保持靜態。完全像this examplejquery header在頁面向下滾動時保持靜態

我看着this onethis one和更多,但沒有找到正確的工作示例。

在此先感謝

<!DOCTYPE html> 
<html> 

<head> 
    <style> 
    #header { height: 100px; background:#EEEEEE; } 
    #footer { height: 100px; background:#EEEEEE; } 
    #content { height: 1000px; background:#CCCCCC; } 
    </style> 

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 
</head> 
<body> 

    <div id="container"> 
     <div id="header">Header</div> 
     <div id="content">Content</div> 
     <div id="footer">Footer</div> 
    </div> 

</body> 
</html> 

回答

1

CSS position:fixed是你在找什麼:

#header { height: 100px; background:#EEEEEE;top:0;left:0;position:fixed } 
相關問題