好的。我的侧边栏有问题。当我向下滚动“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>
不是这样的..如果我使用。它会使边栏在顶部有空间。 –
是的,正确的。但是你需要使用其他样式来放置侧边栏。如果你愿意,我可以展示。 –
让我看看...编辑你最后的答案 –