0
我正在尋找更好的方法來顯示或隱藏使用jQuery盲效應的Google地圖iframe。就目前而言,隨着盲目效應的發生,地圖會跳轉,閃爍並重新調整大小。有沒有什麼建議可以避免這種情況並消除該功能?jQuery UI的平滑效果隱藏顯示|隱藏Google地圖iframe的切換
這裏有一個演示:
http://jsfiddle.net/hmMRs/
HTML標記:
<button class="button" value="Show map">Show map</button>
<div class="map" hidden>
<iframe width="280" height="280" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Google+Headquarters,+1600+Amphitheatre+Parkway,+Mountain+View,+CA&aq=0&oq=google&sll=37.418436,-122.075443&sspn=0.093391,0.133381&t=m&ie=UTF8&hq=Google+Headquarters,+1600+Amphitheatre+Parkway,+Mountain+View,+CA&ll=37.422151,-122.083983&spn=0.009543,0.011973&z=15&iwloc=&output=embed"></iframe>
<br /><small><a href="https://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Google+Headquarters,+1600+Amphitheatre+Parkway,+Mountain+View,+CA&aq=0&oq=google&sll=37.418436,-122.075443&sspn=0.093391,0.133381&t=m&ie=UTF8&hq=Google+Headquarters,+1600+Amphitheatre+Parkway,+Mountain+View,+CA&ll=37.422151,-122.083983&spn=0.009543,0.011973&z=15&iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>
</div>
腳本:
$(".button").click(function() {
$(".map").toggle("blind", 1000);
$(this).text($(this).text() == "Hide map" ? "Show map" : "Hide map");
});
我是比較新的jQuery的那麼如何任何其他意見我可以改進的方法會受到歡迎。謝謝!
你能請幫助我,我有一個類似的問題[這裏](http://stackoverflow.com/questions/31046991/google-maps-iframe-not-centered-and-zoomed-correctly-wen-in-toggle-div)。我試圖複製粘貼jsfiddle的例子來空白HTML文件,它沒有反應。我還包括jquery 1.9.1。仍然沒有,檢查測試文件[這裏](http://www.lopar260.com/test.html)。請幫我完全堅持這一點 – Dreadlord