放大地图然后禁用滚动条
时间: 2023-08-18 08:22:27 浏览: 101
您可以使用CSS样式表来禁用滚动条,并使用JavaScript来放大地图。以下是一个简单的示例:
HTML代码:
```html
<div id="map-container">
<iframe id="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d497307.0565882196!2d-74.259864427135!3d40.697663748526926!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c24fa5d33f083b%3A0xc80b8f06e177fe62!2sNewark%2C%20NJ%2C%20USA!5e0!3m2!1sen!2sca!4v1622760224235!5m2!1sen!2sca" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
</div>
```
CSS样式表:
```css
#map-container {
position: relative;
width: 600px;
height: 450px;
}
#map {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
#map::-webkit-scrollbar {
display: none;
}
```
JavaScript代码:
```javascript
var mapContainer = document.getElementById("map-container");
mapContainer.style.width = "800px";
mapContainer.style.height = "600px";
```
这个示例将地图容器放大到了800x600,禁用了滚动条。
阅读全文