Mona Coder
Mona Coder

Reputation: 6316

How to add style to Google Earth balloon

How can I add CSS class/style to Google Earth balloon which has been created from createFeatureBalloon() method?

I already tried this code by adding .setAttribute("class", "myStyle"); to balloon object but it seems it is not working here. Is there any way to do this in Google Earth?

function showBalloon() {
    var balloon = ge.createFeatureBalloon('div');
    balloon.setFeature(placemark);
    balloon.setAttribute("class", "myStyle");
    balloon.setMaxWidth(600);
    ge.setBalloon(balloon); 
}

Upvotes: 0

Views: 553

Answers (1)

sandrita
sandrita

Reputation: 383

You should create a ballon with:

var balloon = ge.createHtmlStringBalloon('');

Then you create a variable with the html code and then use:

balloon.setContentString(html);

You can view https://developers.google.com/earth/documentation/balloons?hl=in

Upvotes: 0

Related Questions