Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2012-10-10 06:14:53

kosemuckel
Member
Registered: 2012-10-10
Posts: 2

autofit after add Marker / clear Marker

Hi,
my map starts with a added polyline.
Changing mapview -> autofit works
Then i add a marker -> autofit won't work to show polyline and marker
Then i clear the marker -> autofit won't work to show polyline

Chrome js-concole: Uncaught TypeError: Cannot call method 'lat' of undefined

I'm sure it's about me ;) Which point passed my mind?

$(function(){ 
$('#trackmap').gmap3(
	{ action: 'addPolyline',
		options:{
		strokeColor: "#FF0000",
		strokeOpacity: 0.7,
		strokeWeight: 3
		},
		tag: 'track',
		path:[		
		[lat, lon], // array comes from db (code shortened here)		
		[lat, lon],		
		[lat, lon],		
		[lat, lon],		
		[lat, lon]
		]
	},
"autofit"
);
// 

$("#pushMarker").mouseover(function() {
  	$('#trackmap').gmap3(
			{ action: 'addMarker',
				latLng: [54.342475415306, 10.604069298574],
				map:{
					center: true,
					zoom: 14
				},
				marker:{ tag: '1'},
				infowindow:{
					options:{
						content: 'Hello World !'
					}
				}
			}
		);
});
///////			
$("#clear").mouseover(function() {
  	$('#trackmap').gmap3({action:'clear', tag:'1'});
});
///////
$("#autofit").mouseover(function() {
  	$('#trackmap').gmap3({action:'autofit'});
});
});

Offline

Ads
(server costs 27.50€ per month)


Board footer

Powered by FluxBB