I would like to get height and width data of an vimeo iframe (in jquery). I would like to use this datas to put them for the div popin
.
<div class="popin">
<iframe src="https://player.vimeo.com/video....." frameborder="0" width="640" height="320"></iframe>
</div>
.popin {
max-width: ?? iframe value;
max-height: ?? iframe value;
}
Use attr()
to select the with and the height
var width = $('iframe[src*=vimeo]').attr('width');
var height = $('iframe[src*=vimeo]').attr('height');
$('.popin').css({maxWidth:width+'px',maxHeight:height+'px'});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.