在单个地图插件中添加两个位置 [英] Add two location in single map plugin

查看:72
本文介绍了在单个地图插件中添加两个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我在我的joomla3.0项目中使用一个谷歌地图插件。我可以在一个谷歌地图插件中添加两个不同的位置。请给我解决方案



问候

manuel john

hi am using one google map plugin in my joomla3.0 project.how can i add two different location in one Google map plugin. please give solution for me

Regards
manuel john

推荐答案

使用这个函数

use this function
<script type="text/javascript" language="javascript">
	function showMap(lat, lng,div) {
		var latlng = new google.maps.LatLng(lat, lng);
		var mapOptions = {
			zoom: 15,
			maxZoom: 20,
			minZoom: 1,
			scrollwheel: 0,
			center: latlng,
			panControl: true,
			panControlOptions: {position: google.maps.ControlPosition.LEFT_BOTTOM},
			streetViewControl: true,
			zoomControlOptions: {style: google.maps.ZoomControlStyle.LARGE},
			mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		var map = new google.maps.Map(document.getElementById(div), mapOptions);
		map.setCenter(latlng);
		var marker = new google.maps.Marker({
			map: map,
			position: latlng,
			draggable: false,
			title: 'Your title here'
		});
		
	}
</script>



现在您需要调用方法

你可以使用showMap(你的世界,你的长度,你想要显示地图的divid)

例如


and now where you have to call the methoad
you can use showMap(yourlanditude,yourlongitude,divid where you want to show the map)
for example

<script>
showMap(45.121371,84.79029,'map1');
</script>


这篇关于在单个地图插件中添加两个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆