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 &lt;span&gt; ...

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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -