【发布时间】:2021-04-22 07:26:39
【问题描述】:
我正在尝试调整我的 chrome 扩展程序窗口的大小,但我不知道该怎么做。
document.write('<div class="card" id="main-card" style="width: 18rem; height: 20rem;">')
document.write('<img class="card-img-top" src="..." alt="Card image cap">')
document.write('<div class="card-body">')
document.write('<h5 class="card-title">Card title</h5>')
document.write('<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card\'s content.</p>')
document.write('<button id="test" class="btn btn-primary">Go somewhere</button>')
document.write('</div>')
document.write('</div> ')
document.getElementById("test").onclick = function() {
document.getElementById("main-card").style.height = "10rem"
}
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="index.js"></script>
</head>
<body>
</body>
</html>
清单.json { “名称”:“测试”, “版本”:“1.0”, "description": "这个扩展", “作者”:“测试”, “浏览器操作”:{ "default_popup": "index.html", “default_title”:“WRB” }, “清单版本”:2 }
【问题讨论】:
-
澄清一下,您是指扩展程序中的弹出窗口吗?
-
我的意思是当你点击图标时打开的默认弹出窗口。
-
我相信窗口会自动调整大小以适应您的内容,因此如果您需要更改弹出窗口的大小,您只需更改内容的大小即可。
-
当我将引导卡的大小更改为 20rem 之类的数字,然后我的引导卡变为 10rem 时,它不会改变高度。
标签: javascript google-chrome-extension