禁用div上的滚动条

时间:2022-12-05 23:09:27

I have a div.

我有一个div。

I want that user should not be able to scroll the page if the height is more than 350px. Also the scroll bar should be visible in disable mode in that case.

我希望如果高度超过350px,用户不应该滚动页面。在这种情况下,滚动条也应该在禁用模式下可见。

I want to achieve this using javascript.

我想用javascript实现这一点。

Thanks

2 个解决方案

#1


I can't say I completely understood what you want, but I think what you're looking for is CSS not javascript. Take a look at the overflow property.

我不能说我完全理解你想要的东西,但我认为你要找的是CSS而不是javascript。看看溢出属性。

#2


Seems like you're looking for overflow: hidden; perhaps?

好像你正在寻找溢出:隐藏;也许?

#1


I can't say I completely understood what you want, but I think what you're looking for is CSS not javascript. Take a look at the overflow property.

我不能说我完全理解你想要的东西,但我认为你要找的是CSS而不是javascript。看看溢出属性。

#2


Seems like you're looking for overflow: hidden; perhaps?

好像你正在寻找溢出:隐藏;也许?