更改经纬度Google Maps API [英] Changing latitude and longitude google maps api
本文介绍了更改经纬度Google Maps API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户单击链接时,我想更改地图的纬度和经度.当用户单击链接时,我试图要求maps.js,但它不起作用
I would like to change the latitude and longitude of the map when the user click in a link. I have tried to required maps.js when the user clicks on the link but it did not work
maps.js
function maps(){
lats = 53.430967;
longs = -2.960835;
var mapProp = {
center:new google.maps.LatLng(lats, longs),
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
module.exports = maps;
stadium.js
stadium.js
function stadium(){
$( "a:contains('Stadium of Light')" ).on("click", function(){
lats = 54.914740;
longs = -1.388371;
google.maps.event.addDomListener(window, 'load', maps);
window.location.href='maps.html';
});
推荐答案
查看全文