Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望只给我的用户垂直滚动并且达到自动计算的高度,而不是达到页面的整个长度。
是否可以修复我希望给用户的垂直滚动限制。它可以通过jQuery来完成吗????
你可以有一个静态的 divheight和overflow-y:auto
height
overflow-y:auto
只有当里面的内容div超出静态高度时才会显示滚动条
div
div { height:400px; overflow-x:hidden; overflow-y:auto; }
我通过隐藏底层 div 并在我需要它之前显示它来完成这部分。所以,我不需要将垂直滚动设置为特定的高度。