我试图让bootstrap 3手风琴中的iframe只在项目打开时加载。现在所有iframe都在页面加载的同时加载,并导致页面加载很长时间。如何在手风琴项目打开之前停止iframe加载?
这是我的崩溃代码:
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading1">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse1" aria-expanded="false" aria-controls="collapse1">
Title 1 goes here
</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading1">
<ul class="list-group">
<li class="list-group-item"> <iframe src="http://www.google.com"></iframe> </li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading2">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse2" aria-expanded="false" aria-controls="collapse2">
Title 2 goes here
</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading2">
<ul class="list-group">
<li class="list-group-item"> <iframe src="http://www.yahoo.com"></iframe> </li>
</ul>
</div>
</div>
答案 0 :(得分:0)
您可以将SRC属性留空,然后挂钩/设置您自己的事件侦听器,以便在打开手风琴项目时设置iframe的SRC属性,然后