仅加载 div iframe onclick [英] Only load div iframe onclick

查看:15
本文介绍了仅加载 div iframe onclick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这部分代码.加载页面时,所有 div 也已加载但尚不可见.是一种在单击时开始加载 div 内容的方法吗?现在页面因为所有的div而变慢了

I have this part of code. When the page is loaded also all div's are loaded but not yet visible. Is the an way to start loading the content of the div when it's clicked? Now the page is slowed down because of all div's

<a href="#?w=550" rel="popup_add_dossier" class="poplight" title="'.$lang['form_add'].'"><img src="images/icon/new.png" ></a>

<div id="popup_add_dossier" class="popup_block">
<iframe src="add_dossier.php" frameborder="0" scrolling="no" width="550" height="400">

推荐答案

你的意思是只在元素被点击时加载 div 内的 iframe 吗?如果是这样,您可以从 iframe 标记中删除 iframe src 属性,并仅在单击元素时设置 src.

Do you mean load the iframe inside the div only when an element is clicked? If so you can delete the iframe src attribute from the iframe tag and set the src only when the element is clicked.

在 iframe 上:

On the iframe:

<iframe id='ifr' frameborder="0" scrolling="no" width="550" height="400">

关于可点击元素:

onClick='document.getElementById("ifr").src="add_dossier.php";'

这篇关于仅加载 div iframe onclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆