OpenLayers: Adding a (css-)class to a marker?

浪尽此生 提交于 2019-12-06 12:07:54

Maybe the answer is just too obvious: An OpenLayers Icon is no HTML element in the first place but you can get access to an HTML element that will be part of the Icon when drawn on the map: http://dev.openlayers.org/docs/files/OpenLayers/Icon-js.html#OpenLayers.Icon.imageDiv (that is not what comes up when I used the very first link to api docs on the www.openlayers.org, strange) So one might solve this problem like this:

icon.imageDiv.className += " my_icon_class";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!