简体   繁体   中英

How to scroll div inside div while making another div non scrollable

My problem is i need that d1 scrolls on scrolling while d2 scroll only upto certain limit where d1 and d2 div are inside a single div D and scroll property is on div D not on d1 and d2

<div id="D" style="overflow:scroll;"> 
    <div id="d1">some content</div> 
    <div id="d2"> some content</div> 
</div>

I don't think that is possible to achieve without scripting it, which could be messy, considering the numerous events which scroll an element (click, scrollwheel, down arrow, space bar).

Suggestion : Easiest way to achieve this is to create your own scrollbar and do what u want on scroll event..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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