Last active
November 7, 2017 19:24
-
-
Save marcus-at-localhost/4964348 to your computer and use it in GitHub Desktop.
[Bootstrap Tabs reveal $.goMap] google map with a glitch. trigger resize didn't work, so I had to set showing the tab with display:block before rendering the map. maybe the css transition delays it?! anyway here is the fiddle:http://jsfiddle.net/8kdpY/2/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[data-toggle="tab"]').on('show', function (e) { | |
var $target = $(e.target.hash); | |
var h = e.target.hash.indexOf('map-'); | |
if(h != -1 ){ | |
var loc = $target.parents('.tab-content').find('address').data('address'); | |
var id = $target.find('.google-maps').attr('id'); | |
/* set the active class here, because the map init doesn't wait for the .fade.in | |
css trasition from bootstrap | |
*/ | |
// uncomment this | |
$(e.target.hash).addClass('active'); | |
$('#'+id).goMap({ | |
scaleControl: true, | |
maptype: 'ROADMAP', | |
zoom:17, | |
address: loc, | |
hideByClick: false, | |
markers:[{address: loc}] | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment