如何更改mapbox中popupwindow的css?
How to change the css of popupwindow in mapbox?
我正在通过为假冒产品创建一种 airbnb 页面来练习我的 rails 技能。现在我已经在屏幕的前半部分创建了卡片,另一半被 mapbox 覆盖了。一切正常,当我将鼠标悬停在卡片上时,弹出窗口将显示在地图上的标记下方。问题是如何更改 css 或弹出窗口 window 的样式?现在它只是一个带有 tekst 的白色方块。
谢谢
如果您使用的是 GL JS API 提供的 Popup
element exposed by the Mapbox GL JS API, you could check the popup's source code to identify the names of the relevant classes for each component of the HTML element and modify or add to them in your application's CSS. The better option is probably to use the Popup#addClassName
method,它允许您向弹出容器元素添加自定义 class(从而更改元素的样式同时尊重抽象)。
我正在通过为假冒产品创建一种 airbnb 页面来练习我的 rails 技能。现在我已经在屏幕的前半部分创建了卡片,另一半被 mapbox 覆盖了。一切正常,当我将鼠标悬停在卡片上时,弹出窗口将显示在地图上的标记下方。问题是如何更改 css 或弹出窗口 window 的样式?现在它只是一个带有 tekst 的白色方块。
谢谢
如果您使用的是 GL JS API 提供的 Popup
element exposed by the Mapbox GL JS API, you could check the popup's source code to identify the names of the relevant classes for each component of the HTML element and modify or add to them in your application's CSS. The better option is probably to use the Popup#addClassName
method,它允许您向弹出容器元素添加自定义 class(从而更改元素的样式同时尊重抽象)。