[問題] 關於取得google map 新的中心點問題

看板Ajax作者 (央)時間14年前 (2012/04/02 12:03), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
這是我的程式碼 $('.perview').on("click", "img", function(){ var index = $(this).parents('.perview').index(); $('.info_content').stop(true,false).animate({opacity: 0},300).animate({opacity: 1},300); $('.info_content_bg').stop(true,false).animate({opacity: 0},300).animate({opacity: 0.2},300); $('.info').hide().empty().append( datas[index].vName, '<img class="vImg1" src="'+ datas[index].vImg1 +'" width="300" height="225" />', datas[index].vSummary, datas[index].Add, datas[index].Tel ).delay(300).fadeIn(500); //問題所在地↓ var latlng_new = { lat: datas[index].vLat, lng: datas[index].vLng }; map.panTo(latlng_new); }); 流程: 當我點選 .perview img 後,會讀取我datas 裡的相關資料,包括經緯度。 問題: 我創了一個經緯度陣列, 希望點選後,地圖的中心點會變更到,該點選的經緯度, map.panTo(latlng_new); 的用法,有錯嗎? 因為他不會動.... -- Blog http://oao54bb.blogspot.com/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.240.34.196

04/02 16:18, , 1F
試試 var latlng_new = new google.maps.LatLng(
04/02 16:18, 1F

04/02 16:18, , 2F
datas[index].vLat, datas[index].vLng);
04/02 16:18, 2F

04/02 21:28, , 3F
cool 成功了! 太感謝了
04/02 21:28, 3F
文章代碼(AID): #1FUIKhru (Ajax)
文章代碼(AID): #1FUIKhru (Ajax)