自从升级到OpenLayers 2.13后,我试图将我的Google Map版权放在页面的左下角,但它总是想要转到右下角。
我在加载时试了这个(没用):
.gmnoprint{
left:'0px';
right:'';
}
我尝试修改我认为Openlayers.js中的相关行(不起作用):
e = document.createElement("div");
e.id = this.map.id + "_GMap2Container";
e.style.position = "absolute";
e.style.width = "100%";
e.style.height = "100%";
d.appendChild(e);
try {
a = new GMap2(e), b = e.lastChild, d.appendChild(b), b.style.zIndex =
"1100", b.style.right = "",b.style.left = "0px", b.style.bottom = "", b.className = "olLayerGoogleCopyright", c = e.lastChild, d.appendChild(c), c.style.zIndex = "1100", c.style.right = "",c.style.left = "0px", c.style.bottom = "", c.className = "olLayerGooglePoweredBy gmnoprint"
} catch (f) {
throw f;
}
我在使用jQuery加载后尝试了这个(但是只有当你设置一个不是最佳选择的超时时工作,因为它会在重新定位时导致闪烁):
$('.gmnoprint').css({'left':'0px','right':''})
前两次尝试我做错了什么?
答案 0 :(得分:1)
第一个解决方案的问题是,这些元素的位置直接在style属性中设置。所以它会覆盖由班级设定的位置。
我猜第二个不起作用,因为除了openlayers.js之外,一些谷歌javascript正在乱七八糟。但这只是猜测。
您可以将自己注册为图层的事件监视器并将其设置为css,但这不会解决您的闪烁问题。
Here是一种解决方案,可以满足我的需求。