弹出窗口中的滚动条:默认没有水平滚动条,但当内容很大时启用滚动条

Scroll Bar in Popup : no horizontal scroll bar by default but enable scroll bar when content is big

本文关键字:滚动条 启用 窗口 默认 水平      更新时间:2023-09-26

我有一个名为搜索弹出窗口。我明白了,要启用滚动条弹出,我们可以通过scrollbar = yes来实现。但是我的弹出窗口的内容默认不大,在弹出窗口提交功能后,它会在弹出窗口中抛出数据。所以我需要带滚动条的弹出框。

我的问题是如何启用滚动条时,内容很大,禁用滚动条时,内容适合弹出框?你能帮我一下吗?

<!DOCTYPE html>
<html>
<body>
<p>Click the button to open a new browser window.</p>
<button onclick="myFunction()">With Maximize</button>
<script>
function myFunction() {
   var leftCornerX = screen.width/2 - 820/2;
var leftCornerY = screen.height/2 - 480/2;
    window.open("Search Popup","Sample Popup","scrollbars=yes,status=no,resizable=no,width=820,height=480,left= "+leftCornerX +",top="+leftCornerY);
}
</script>
</body>
</html>

使用

overflow:auto;
css