var map;
init();
function init() {
//Setup the map
var googleMapOptions = {
center: new google.maps.LatLng(53.5267, -1.13330),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Start the map
map = new google.maps.Map(document.getElementById("map_canvas"),
googleMapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(53.5267, -1.13330),
});
marker.setMap(map);
//giving the longitudunal coordinate of the infoBubble based on current zoom level
var newlong = marker.getPosition().lng() + (0.00003 * Math.pow(2, (21 - map.getZoom())));
infoBubble = new InfoBubble({
content: '<div class="example">Some label</div>',
position: new google.maps.LatLng(53.5267, newlong),
shadowStyle: 1,
padding: 10,
borderRadius: 5,
minWidth: 200,
arrowSize: 0,
borderWidth: 1,
borderColor: '#2c2c2c',
disableAutoPan: true,
hideCloseButton: false,
arrowPosition:7,
backgroundClassName: 'example',
arrowStyle: 2
});
infoBubble.open(map);
//position infoBubble for each zoom level change, based on arithmetic logic (notice the power of 2)
google.maps.event.addListener(map, "zoom_changed", function() {
newlong = marker.getPosition().lng() + (0.00003 * Math.pow(2, (21 - map.getZoom())));
infoBubble.setPosition(new google.maps.LatLng(marker.getPosition().lat(), newlong));
});
}
//Both position and pixeloffset do not have any effect on the infoBubble. They are both shown to show my syntax (perhaps...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.