我在我的網站中有一個頁面,裏面有大約60個iframe元素。這些iframe包含在w3-modals divs中,但是隻要頁面加載就會加載,導致頁面加載非常緩慢。是否有可能當用戶點擊按鈕來加載w3模式,他們的iframe可以加載,然後幫助頁面加載時間。當用戶點擊模式時加載iframe
任何幫助將非常讚賞與此!但如果可能的話,請保持簡單,因爲我是編碼新手。
非常感謝!
下面是代碼im使用:
按鈕加載模態
<button onclick="document.getElementById('id03').style.display='block'" class="w3-btn w3-light-blue">Instruction</button>
模態碼
<div id="id03" class="w3-modal">
<iframe src="http://" frameborder="0" height="700px" style="width: 800px">
我覺得[this](http://stackoverflow.com/questions/7177080/how-do-i-load-an-url-in-iframe-with-jquery)會幫助你。這個問題看起來一樣。 –