只加载div iframe点击 [英] Only load div iframe onclick

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

问题描述

我有这部分代码。当页面被加载的时候,所有的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">


推荐答案

一个元素被点击?如果是这样,您可以从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上:

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

在可点击的元素上:

On the clickable element:

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

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

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