【问题标题】:How to move the default google maps information window scrollbar to the right of the close button?如何将默认的谷歌地图信息窗口滚动条移动到关闭按钮的右侧?
【发布时间】:2016-01-05 17:44:47
【问题描述】:
显示信息窗口的滚动条时,它会显示在 X 按钮的左侧,并在窗口内容的右侧占据相当多的空间。添加以下 CSS 时会显示滚动条:
.mapInfoWindow {
max-height:100px;
overflow-y: auto;
}
我想将滚动条移到关闭按钮的右侧。
我该怎么做?
我在上述任何一个方面都找不到任何帮助。
见小提琴here。
【问题讨论】:
标签:
javascript
html
css
google-maps
infowindow
【解决方案1】:
将 InfoWindow 中的内容包装在 DIV 标记中
使用 CSS 样式设置 DIV 标签:
line-height:1.35;
overflow:hidden;
white-space:nowrap;
overflow:hidden 和 white-space:nowrap 都确保不显示滚动条。但是,长文本可能会溢出信息窗口。
var infowindow = new google.maps.InfoWindow({content: '<div style="line-height:1.35;overflow:hidden;white-space:nowrap;">ADD CONTENT</div>'});
希望这可能会有所帮助