简体   繁体   English

如果div固定,则显示全部内容

[英]Show full content if div is fixed

Here i have two long div s. 在这里,我有两个long div The first div is fixed, and I want to show all elements of div.content when user scrolls (because I have full elements on first div . How can i do this? 第一个div是固定的,我想在用户滚动时显示div.content所有元素(因为我在第一个div上有完整的元素。我该怎么做?

<div style="display: block; width: 100%;">

    <div style="float: left; position: relative; z-index: 0;">
        <div style="position: relative;">
            <div class="content" style="padding-top: 10px; top: 10px; position: fixed;">

                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                <div style="margin-top: 10px;">MENU</div>
                 Show element after user scrolls
            </div>
        </div>
    </div>

    <div style="float: left; margin-left: 11%; width: 67%;">

        Right DIV FUll LONG TEXT

    </div>

</div>

Just check this out. 只需检查一下。 I think just in you fixed content block you have to add some height then give overflow scroll. 我认为只是在固定内容块中,您必须增加一些高度,然后进行溢出滚动。

 <div style="display: block; width: 100%;"> <div style="float: left; position: relative; z-index: 0;"> <div style="position: relative;"> <div class="content" style="padding-top: 10px; top: 10px; position: fixed;overflow-y: scroll;height: 186px;"> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> <div style="margin-top: 10px;">MENU</div> Show element after user scrolls </div> </div> </div> <div style="float: left; margin-left: 11%; width: 67%;"> Right DIV FUll LONG TEXT </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM