javascript - openlayers3 - Set Node as label for ol.control.FullScreen control -
i'm trying set custom span (<span class="fa fa-expand"></span>
) label of openlayers 3 fullscreen control.
according documentation, should possible. documentation states:
label string | node | undefined experimental
text label use button. default \u2922 (north east , south west arrow). instead of text, node (e.g. span element) can used.
i tried setting label this:
let fullscreencontrol = new ol.control.fullscreen({ classname: 'fullscreen-button', label: '<span class="fa fa-expand"></span>' });
but seems html encode tag. when check generated button in developer console, adds <span>
...
can guide me on how set "node" label or in general correct way set custom span label of control? thanks
you need create element object:
var myspan = document.createelement("span"); myspan.classname = "fa fa-expand"; var fullscreencontrol = new ol.control.fullscreen({ classname: 'fullscreen-button', label: myspan });
Comments
Post a Comment