Skip to content

Instantly share code, notes, and snippets.

@Szpadel
Created June 3, 2015 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Szpadel/e3c4450bfb765dbfbb30 to your computer and use it in GitHub Desktop.
Save Szpadel/e3c4450bfb765dbfbb30 to your computer and use it in GitHub Desktop.
Adds css classes to google maps popups
(function(){
function styleAllBoxes() {
var cnt = $('.gm-style-iw');
cnt.each(function(index){
styleBox($(cnt[index]));
});
}
function styleBox(item) {
var cnt = item.parent();
var close = cnt.children().last().addClass('gm-info-close');
var box = cnt.children('div').first();
box.addClass('gm-info-box');
var bg = box.children().last();
bg.addClass('gm-background');
var arrow = box.children().last().prev().find('div>div');
arrow.addClass('gm.info-arrow');
}
var map = $('.gm-style').on('DOMNodeInserted', styleAllBoxes);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment