admin管理员组文章数量:1351978
I added to to the iframe a class with css
width:100%;
height:auto;
but does not work for the height.
Any ideas better than jquery dirty fix
$(window).resize(function(){
var tempwidth=$(".vimeoiframe").width();
var tempheight=tempwidth/1.25;
$(".vimeoiframe").css("height",tempheight);
});
Since not all my videos have this aspect ratio.
I added to to the iframe a class with css
width:100%;
height:auto;
but does not work for the height.
Any ideas better than jquery dirty fix
$(window).resize(function(){
var tempwidth=$(".vimeoiframe").width();
var tempheight=tempwidth/1.25;
$(".vimeoiframe").css("height",tempheight);
});
Since not all my videos have this aspect ratio.
Share Improve this question asked May 7, 2012 at 18:56 DanielDaniel 1,1242 gold badges13 silver badges31 bronze badges 2- Your jQuery dirty fixed worked pretty damn well for me if I may say so. Way better than having to use a plugin to do such a simple thing. – Lee Commented Mar 27, 2014 at 14:28
- @lee I also use it rather than plugins when I know all videos will have same aspect ratio. – Daniel Commented Mar 27, 2014 at 19:00
2 Answers
Reset to default 4You should take a look at this jQuery plugin, seams that was wrote for you
FitVids.js
There is an entire article about it on CSS Tricks as well
Fluid Width YouTube Videos
And his magazine article
Create fluid width videos
Or you could use percentage ratios, http://codepen.io/maxmckenzie/pen/hFzak the video dose not load in codepen for some reason.
本文标签: javascriptDynamic resize of Vimeo Video (or Youtube)Stack Overflow
版权声明:本文标题:javascript - Dynamic resize of Vimeo Video (or Youtube) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743896545a2557890.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论