Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 210725

Fix for: Bounds of [locations_map] not set correctly

$
0
0

Replies: 0

When I was inserting the [locations_map], the bounds were coming out set all strange.

I added this javascript function to the page that the map lived on, and it’s good to go.

jQuery(document).on('em_maps_locations_hook', function(e, map, data) {
	var bounds = new google.maps.LatLngBounds();
	for (var i = 0; i < data.length; i++) {
		if (!(data[i].location_latitude == 0 && data[i].location_longitude == 0)) {
			var latitude = parseFloat(data[i].location_latitude);
			var longitude = parseFloat(data[i].location_longitude);
			bounds.extend(new google.maps.LatLng(latitude,longitude));
		}
	}
	map.fitBounds(bounds);
});

This really just needs to be fixed in the plugin itself and could replace the logic in lines 880-891 in events-manager/includes/js/events-manager.js?ver=5.6624


Viewing all articles
Browse latest Browse all 210725

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>