简体   繁体   中英

Prevent scroll outside of the ul li dropdown

I have a code like below

https://plnkr.co/edit/LG8cOx?p=preview

I am trying to make a dropdown of ul li, in which i can scroll and select the element by enter. Now if page height is more like in example i have given, the scrolls on the ul li scrolls the page also. How do i prevent this?

.newMarginBottom {
  min-height: 1100px;
  border:1px solid red;
}

You should use max-height property

.newMarginBottom {
  max-height: 1100px;
  border:1px solid red;
}

Update 1:

arrow keys issue can be resolved when you are using max-height:auto

Updated plunker

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