我的页面中有更多iframe来加载视频。


现在我想在打开页面时阻止iframe自动加载。
什么现在正在发生的是我打开页面时会加载所有iframe。


 < div id =“youtube-customers-add”style =“float:left ;宽度:60%;高度:100%;“>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/ivlfaPPP8TY”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-customers-edit”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/8LupmPYSYIo”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-dashboard”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/viCPPRHohSs”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-finance”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/MYneEOIJYp0”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-finance-add”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/CEeuWTqjhQY”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-finance-edit”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/p-NSAonIhgA”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV>
 < div id =“youtube-payments”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/pURkv_rng-Y”frameborder =“0”allowfullscreen>< / iframe>
 < / DIV> 
 < div id =“youtube-partslabor”style =“float:left; width:60%; height:100%;”>
 < iframe width =“100%”height =“100%”src =“https://www.youtube.com/embed/5Ik7WVRxs7c”frameborder =“0”allowfullscreen>< / iframe>
 < / div>



 那么,我该如何防止这种情况?


感谢

答案 0 :(得分:0)
您可以重命名src
属性
src-a="https://www.youtube.com/embed/p-NSAonIhgA"
我想你想在某个事件上加载iframe,所以你应该使用JavaScript,我认为你需要jQuery when element becomes visible
答案 1 :(得分:0)
你在这里:
for (var i = 0; i < window.frames.length; i++) {
if (navigator.appName == 'Microsoft Internet Explorer') {
window.frames[i].document.execCommand('Stop');
} else {
window.frames[i].stop();
}
}
希望得到这个帮助。