I want to show google map on popover
But the popover fails to change map
Only works when the map is fixed
My code :
$(function(){
// getmap function from http://stackoverflow.com/questions/10545768/google-map-in-twitter-bootstrap-popver
var getMap = function(opts) {
var src = "http://maps.googleapis.com/maps/api/staticmap?",
params = $.extend({
center: 'New York, NY',
zoom: 14,
size: '512x512',
maptype: 'roadmap',
sensor: false
}, opts),
query = [];
$.each(params, function(k, v) {
query.push(k + '=' + encodeURIComponent(v));
});
src += query.join('&');
return '<img src="' + src + '" />';
}
$('.map').click(function(){
location = $(this).text();
$("#map").html(getMap({center: location}));
});
$('.map').popover({trigger:'click',placement:'left',html:true,content:function(){
return $("#map").html();
}});
});
My problem with this function :
$('.map').click(function(){...});
With Click on the link(.map) because the #map is changed, the popover is broken and does not work
Thank you