我正在尝试修改fitvid.js脚本。
我正在研究这个片段:
$allVideos.each(function(count){
var $this = $(this);
if($this.parents(ignoreList).length > 0) {
return; // Disable FitVids on this video.
}
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
{
$this.attr('height', 9);
$this.attr('width', 16);
}
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height();
var width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width();
if ($this.attr('src').toLowerCase().indexOf("video.corriere.it") >= 0) {
console.log($this.parent('.embeddedContent'))
console.log(height);
console.log(width);
height = height + 67;
}
这一行
console.log($this.parent('.embeddedContent'))
在控制台中回复我:
[div.embeddedContent, prevObject: jQuery.fn.init[1], context: iframe]
0: div.embeddedContent
clientHeight: 358
clientLeft: 0
clientTop: 0
clientWidth: 572
我需要获取“clientWidth”。我该怎么办?