Mam witrynę (wordpress), na której znajduje się kilka tysięcy wpisów. Post będzie wyglądać tak:Problem z iframe należy zmniejszyć czas na dzielenie się stronami
[tab:source1]
<iframe width="560" height="315" src="https://www.youtube.com/embed/U3rKPexoEcA" frameborder="0" allowfullscreen></iframe>
[tab:source2]
<iframe src="https://player.vimeo.com/video/60718161?title=0&byline=0&portrait=0&badge=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/60718161">HOW TO SHARPEN PENCILS</a> from <a href="https://vimeo.com/pricefilms">Pricefilms</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
[tab:source3]
<iframe width="640" height="360" src="http://www.worldstarhiphop.com/embed/100588" frameborder="0" allowfullscreen></iframe>
Moje czasy ładowania strony są czasami w postaci podwójnej cyfry. Rozumiem, dlaczego tak się dzieje, ale nie jestem pewien, jak to naprawić. Chcę naprawić go albo:
Iframe setTimeout()
Lub: Dynamiczny Asynch iframe, który wygląda tak:
<script>
(function(d){
var iframe = d.body.appendChild(d.createElement('iframe')),
doc = iframe.contentWindow.document;
// style the iframe with some CSS
iframe.style.cssText = "position:absolute;width:200px;height:100px;left:0px;";
doc.open().write('<body onload="' +
'var d = document;d.getElementsByTagName(\'head\')[0].' +
'appendChild(d.createElement(\'script\')).src' +
'=\'\/path\/to\/file\'">');
doc.close(); //iframe onload event happens
})(document);
</script>
przypadku obu metod, jak bym zastosować tę globalnie do wszystkich iframe na całej stronie? Nie sądzę, że można indywidualnie zmienić każdy element iframe.