[英]Location marker on map jquery
I used location marker on my address. 我在地址上使用了位置标记。 but can't work properly for map and location marker 但不能用于地图和位置标记
HTML code. HTML代码。
<section class="contact-map2" id="contact-map2">
</section>
Jquery code. jQuery代码。
<!-- Jquery -->
<script src="js/jquery-3.1.1-min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAT4sxB6QJ6yqBA7bve0j6wLYSHeF2NKs0&sensor=false&libraries=places"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', init);
function init() {
mapInit(11.01392086,76.96254899,"contact-map2","images/pin-house-green.png", true);
}
</script>
please help me for solve this problem. 请帮我解决这个问题。
To add a location marker use this code: 要添加位置标记,请使用以下代码:
<script>
function initMap() {
var uluru = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: uluru
// You can set more attributes value here like map marker icon etc
});
var marker = new google.maps.Marker({
position: uluru,
map: map
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"></script>
<div id="map"></div>
here callback=initMap
will call the initMap()
on page load and render the map with location marker. 这里callback=initMap
将在页面加载时调用initMap()
并使用位置标记呈现地图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.