2013-02-18 163 views
1

我使用在我用過型IFrame不再加載谷歌地圖

<script> 
    jQuery("#menu-item-1670 a").fancybox({ 
       'width'    : '75%', 
       'height'   : '75%', 
       'autoScale'   : true, 
         'zoomSpeedIn': 300, 
         'zoomSpeedOut': 300, 
      'overlayOpacity' : 0, 
       'type'    : 'iframe' 
      }); 
</script> 

通過花式盒來彈出一個谷歌地圖,但是當我點擊谷歌地圖上,然後第一次顯示地圖,但是當我嘗試點擊第二次然後它不會出現..不知道爲什麼? 這裏是我試圖實現的鏈接 http://kelts.wpengine.com/ 屬性詳細信息tab->點擊屬性圖.-> firsttime顯示 - >不是第二次。

試過但沒有運氣!

謝謝!

+0

鏈接已損壞。 – jjj 2013-02-18 09:43:32

+0

是的,我知道它,當我再次點擊鏈接,然後它不與地圖來源..如何解決這個問題。任何想法? – sudhanshu 2013-02-21 05:16:46

回答

0

第二次我打開盒子時,iframesrc屬性爲about:blank。有一個線程here可能解決問題 - 它建議使用onComplete回調來存儲src,並使用onClosed回調來恢復它。

不知道它是否適用於您的特定情況,但它似乎值得一試。

如果我讀過,鏈接和正確的來源,這應該做的伎倆:

<script> 
    jQuery(document).ready(function() { 
     var mySRC =""; 
     jQuery("#menu-item-1670 a").fancybox({ 
     'width'    : '75%', 
     'height'   : '75%', 
     'autoScale'   : true, 
     'zoomSpeedIn'  : 300, 
     'zoomSpeedOut'  : 300, 
     'overlayOpacity' : 0, 
     'type'    : 'iframe', 
     'onComplete': function() { 
      // alert('onComplete called'); 
      mySRC = jQuery('#map_title iframe').attr('src'); 
     }, 
     'onClosed': function() { 
      // alert('onClosed called'); 
      jQuery('#map_title iframe').attr('src',mySRC); 
     } 
     }); 
    }); // ready 
</script> 

如果它的工作原理,通過JFK挖掘出一個答案,給他/她一個給予好評 - 它看起來像他/她是代碼的來源。

+0

不幸的是沒有運氣!請任何其他想法! – sudhanshu 2013-02-21 05:32:53

+0

對不起,沒有注意到你沒有使用'$'作爲jQuery。我更新了代碼。你可以再試一次嗎? – Hobo 2013-02-21 07:24:24

+0

嘿Hobo!我已經試過了,因爲你已經給我發了$ code,但是我把它轉換成Jquery語法,但是沒有運氣的人!在這裏你可以檢查我使用的代碼。請看你可以在主頁上找到的代碼的來源-footer section http://kelts.wpengine.com/。請幫我.. – sudhanshu 2013-02-21 09:00:18