I am trying to create new buttons but I seem to use the wrong function. To delete the default buttons I added the following code:
var map = new ol.Map({
target: 'map',
controls: [],
layers: [
new ol.layer.Tile({ ... etc
This works great. Now I am trying to connect a button I created with HTML (id=btnZoomOut) to the Zoom function:
var buttonZoomOut = new ol.control.Control({element: $('#btnZoomOut')});
map.addControl(new ol.control.Zoom({target: buttonZoomOut}));
But this does not seems to works and trows an error:
Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).appendChild is not a function
How to correctly do this?
#btnZoomOut
element be outside of map? If you just want to change zoom control position you can pass a custom CSS class to the constructor.