2012-02-25 22 views
1

私はTwitterのようなナビゲーションバーを作っていますが、そのバーの中の1つのdivが通知やニュースでスクロールし、他のバーのコンテンツはそのままの状態にしておきたいと思います。なにか提案を? http://jsfiddle.net/fdezluis96/JJ29E/独立したdivの切り替え

#navigation{ 
position:fixed; 
top:0; 
left:0; 
width:100%; 
padding:5px; 
color: #fff; 
height:32px; 
font-size:20px; 
background: #333; 
}​ 

そして、これは

<div id="navigation">This is the main div static content 
    <div id="subnavigation">This is the scrolling content.</div> 
</div>​ 

おかげでメインのHTMLコードです! live-pin.comウェブサイトの

答えて

0

、これは動作しているようです:

<!-->Add "position: relative;" to have a non-statically position parent.</--> 
<div class="nav-collapse" style="position: relative;"> 

<!-->Change inline styles from "background:#fff; width:300px; overflow:auto;" to "background: #fff; border: 1px solid #fff; border-top-width:0px; border-bottom-width:0px; background: #666; border-radius: 5px; border-top-right-radius: 0px; border-top-left-radius: 0px; position: absolute; max-width: 300px;" (mostly from the fiddle, but "position: absolute" to keep it where it is and remove it from the normal document flow; removing it from the document flow is what allows it to escape its parent's containment.) </--> 
<li id="notificationss" style="background: #fff; border: 1px solid #fff; border-top-width:0px; border-bottom-width:0px; background: #666; border-radius: 5px; border-top-right-radius: 0px; border-top-left-radius: 0px; position: absolute; max-width: 300px;"> 
    dssdadsadas 
    <br>dsadsasdadssdadsadas 
    <br>dsadsasdadssdadsadas 
    <br>dsadsasdadssdadsadas 
    <br>dsadsasdadssdadsadas 
    <br>dsadsasdadssdadsadas 
    <br>dsadsasda 
</li> 
+0

http://jsfiddle.net/fdezluis96/JJ29E/2/ <---テスト、動作しません。 – Luis

+0

Chromeで私のために働くと思われる:http://jsfiddle.net/JJ29E/6/あなたが望むものを誤解している場合を除き... – pete

+0

私は2セクションABCを持っています。ここでC = A、両方がCSS-Sameになり、Bがスクロールコンテンツになります。私は、Aが定義された高さ(24px)を持つようにし、CはAと同じで静的なので静的で、Bはページ内で "飛んでいく"コンテンツを持っていますjsfiddle http://jsfiddle.net/fdezluis96/JJ29E/、テーブルの例。 – Luis

関連する問題