如何将 CSS 类/样式添加到通过
createFeatureBalloon()
方法创建的 Google 地球气球?
我已经通过将
.setAttribute("class", "myStyle");
添加到气球对象来尝试此代码,但它似乎在这里不起作用。有没有办法在 Google Earth 中做到这一点?
function showBalloon() {
var balloon = ge.createFeatureBalloon('div');
balloon.setFeature(placemark);
balloon.setAttribute("class", "myStyle");
balloon.setMaxWidth(600);
ge.setBalloon(balloon);
}
你应该用以下内容创建一个气球:
var balloon = ge.createHtmlStringBalloon('');
然后用 html 代码创建一个变量,然后使用:
balloon.setContentString(html);
您可以查看https://developers.google.com/earth/documentation/balloons?hl=in