1
我已經應用了以下js,以使youtube視頻變得快速響應。 視頻是發生在IFRAME 這裏是腳本 - :YouTube視頻沒有響應
var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com']"),
$fluidEl = $(".newsblock_maintext");
$allVideos.each(function() {
$(this)
.data('aspectRatio', this.height/this.width)
.removeAttr('height')
.removeAttr('width');
});
$(window).resize(function() {
var newWidth = $fluidEl.width();
$allVideos.each(function() {
var $el = $(this);
$el
.width(newWidth)
.height(newWidth * $el.data('aspectRatio'));
});
}).resize();
而且低於自己的YouTube視頻被賦予被放置在「newsblock_maintext」分區。
<div class="newsblock_maintext"><p>Bekijk hier de nieuwe kijk op het wonen volgens MisuraEmme: "The way you are furniture for 24H life-style" zoals onlangs gepresenteerd is, tijdens de succesvolle Salone del Mobile 2015.</p><p><iframe width="560" height="315" frameborder="0" src="https://www.youtube.com/embed/8Ei0jelpeGQ"></iframe></p></div>