作者jami520 (我的生命因你而發光)
看板Web_Design
標題[問題] ajax tab載入google地圖無法顯示?
時間Tue Feb 17 15:22:08 2015
目前我用ajax tab載入外部網頁,只要是文字的網頁都OK
但現在我額外做了一個google map的網頁如下
http://alumi.why3s.tw/ajax-tabs-demo/tt.html
上述瀏覽是OK的
http://alumi.why3s.tw/ajax-tabs-demo/
(第二個TAB的google地圖)
但我將它加入到TAB中就無法呈現,是哪邊的問題嗎?
我將它壓縮成這個檔案,有否高手可以幫我看看是哪邊的問題呢?
http://alumi.why3s.tw/ajax-tabs-demo/demo.zip
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.246.221.150
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Web_Design/M.1424157731.A.97F.html
1F:推 iamnodoubt: 不確定為什麼你tab內容都用link的方式,我打開console 02/17 19:55
2F:→ iamnodoubt: google undefined,很明顯就是google script外掛沒吃到 02/17 19:56
3F:→ iamnodoubt: 我加到index.html,google undefined消失,但是跳不能 02/17 19:58
4F:→ iamnodoubt: write google api script on document,你為何不用傳統 02/17 20:00
5F:→ iamnodoubt: tab處理方式,display:none ,display:block,程式碼短又 02/17 20:00
6F:→ iamnodoubt: 沒這個問題.... 02/17 20:01
7F:→ iamnodoubt: 不然你就把google map寫在index,再去控制show hide 02/17 20:05
8F:→ jami520: 因為全部同時載入所耗時間很多,所以我希望有點選TAB才 02/17 20:14
9F:→ jami520: 載入外部網頁,傳統方式可達到這效果嗎? 02/17 20:15
10F:→ jami520: 還是我原本的作法有解決方式呢?我試過將google map程式 02/17 20:28
11F:→ jami520: .html顯示tab內容的div那邊也無法正常秀出地圖,但改換 02/17 20:28
12F:→ jami520: 就OK,不知道是否tab顯示div那個css還是js有問題否,看是 02/17 20:30
13F:推 oToToT: 真的不行,最爛的方式就用iframe吧XD 02/17 21:05
14F:推 poiuy999: Google map 在display none 時就load會載不完全 要在js 02/19 21:32
15F:→ poiuy999: display block時才對map 做load才會正常 02/19 21:32
16F:→ jami520: 加入載入判斷就解決了,感謝各位高手的回覆。 02/20 11:08