Jquery 独立div切换

Jquery 独立div切换,jquery,html,css,notifications,scroll,Jquery,Html,Css,Notifications,Scroll,我正在制作一个类似Twitter的导航栏,但我希望该栏中的一个div向下滚动显示通知或新闻,而另一个栏的内容保持“原样”。有什么建议吗? 这是主要的HTML代码 <div id="navigation">This is the main div static content <div id="subnavigation">This is the scrolling content.</div> </div>​ 这是div的主要静态内容

我正在制作一个类似Twitter的导航栏,但我希望该栏中的一个div向下滚动显示通知或新闻,而另一个栏的内容保持“原样”。有什么建议吗?

这是主要的HTML代码

<div id="navigation">This is the main div static content
    <div id="subnavigation">This is the scrolling content.</div>
</div>​
这是div的主要静态内容
这是滚动内容。
​

谢谢

对于live-pin.com网站,这似乎是可行的:

<!-->Add "position: relative;" to have a non-statically position parent.</-->
<div class="nav-collapse" style="position:  relative;">
添加“位置:相对”;以具有非静态位置父对象。

将内联样式从“背景:#fff;宽度:300px;溢出:自动”更改为“背景:#fff;边框:1px实心#fff;边框顶部宽度:0px;边框底部宽度:0px;背景:#666;边框半径:5px;边框右上半径:0px;边框左上半径:0px”(位置:绝对值;最大宽度:300px;)大部分来自小提琴,但“position:absolute”将其保留在原处,并将其从正常文档流中删除;将其从文档流中删除可以使其脱离其父级的限制。)
  • 达达斯达斯
    DSADSASDADSDADSASDAS
    DSADSASDADSDADSASDAS
    DSADSASDADSDADSASDAS
    DSADSASDADSDADSASDAS
    DSADSASDADSDADSASDAS
    dsadsasda

  • 在Chrome中似乎对我很有用:除非我误解了你想要什么…我的意思不完全是这样,我有两个部分A B C,其中C=A,两者都是CSS,B是滚动内容。我希望A有一个定义的高度(24px)它保持这样,静态,因为C和A一样,它也会是静态的,B的内容会在页面中“飞行”,就像在这个JSFIDLE,表格示例中。然后,这正是我的意思,但在我的页面上不起作用,有一个示例D:请帮助
    <!-->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>