最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

toggle - Instantly switch between light and dark mode with Google Maps JS API using mapID - Stack Overflow

programmeradmin9浏览0评论

I previously used darkmode.addEventListener('change', ({ matches }) => map.setOptions({ styles: matches ? darkmodeStyles : null })); which worked great! But since Google Maps is deprecating google.maps.Marker I need to switch to google.maps.marker.AdvancedMarkerElement, which requires a mapID and styling doesn't work anymore when mapID is used.

Is there a way to instantly switch to dark mode when using mapIDs?

Because the only solution I see currently is to create a whole new map instance in order to provide a new mapID, but that is not an acceptable solution to switch to dark mode because you lose the current map.

发布评论

评论列表(0)

  1. 暂无评论