[英]How to place the zoom control inside another div in openlayers 3?
I have a div laying on top of an ol3-map in which I'd like to place my zoom control. 我在ol3-map上放置了一个div,我想在其中放置缩放控件。 In ol2 this was fairly easy to do, but I haven't found this option in ol3 yet.
在ol2中,这很容易做到,但是我还没有在ol3中找到此选项。
Here's an unsuccesful attempt using the ol2-methodology, applied to ol3. 这是使用应用于ol3的ol2-方法的不成功尝试。
map = new ol.Map({
layers: [bingMapsRoad, layerBiomass],
target: 'map',
view: new ol.View({
projection: 'EPSG:4326',
center: [1,16.7],
zoom: 8
}),
controls: ([]) //initialize without controls
});
var external_control = new ol.control.Zoom({
div: document.getElementById('external_control') });
map.addControl(external_control);
Unfortunately this code results in the zoom control still being placed on the map instead of inside the div. 不幸的是,此代码导致缩放控件仍放置在地图上而不是div内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.