好的。我的側邊欄有問題。當我向下滾動「Hello,world?」時,我想讓左邊欄固定並上升側欄會像STICKY一樣上升。我不想用插件。我需要一些簡短的代碼。它只是用於這一點。幫助我與jsfiddle。謝謝如何讓側邊欄固定滾動像粘滯
*/i want use javascript.../
#header { clear:both; width: 100%; background-color: darkorange; border-top: 1px solid #d2d2d3; border-bottom: 1px solid #d2d2d3; margin: 20px 0px 20px 0px;}
h1.head {font-family: verdana; font-size: 200%;}
a { color: orange;}
.sidebar { float: left; width: 25%; height: 100%;}
#text { float: left; width: 70%;}
body { text-align:center;}
p, p a {text-align: left; font-size: 90%;}
<body>
<div id="header">
\t <h1 class="head"><b>Hello, world ?</b></h1>
</div>
<div id="bar-fixed">
\t <div class="sidebar">
\t \t <p class="bar"><a href="#">
\t \t Make this fixed when scroll</a></p>
\t \t <p class="bar"><a href="#">
\t \t Make this fixed when scroll</a></p>
\t \t <p class="bar"><a href="#">
\t \t Make this fixed when scroll</a></p>
\t \t <p class="bar"><a href="#">
\t \t Make this fixed when scroll</a></p>
\t \t <p class="bar"><a href="#">
\t \t Make this fixed when scroll</a></p>
\t </div>
</div>
<div id="text">
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
<p>I want the sidebar fixed when i scroll down over the Header. and the sidebar will go up LIKE STICKY SIDEBAR</p>
</div>
</body>
不是這樣的..如果我使用。它會使邊欄在頂部有空間。 –
是的,正確的。但是你需要使用其他樣式來放置側邊欄。如果你願意,我可以展示。 –
讓我看看...編輯你最後的答案 –