简体   繁体   English

如何输出宽度=“ 100%”或宽度=“”的iframe。 不,宽度=“ 100”

[英]How do I output an iframe with width = “100%” or width = “”. Not, width = “100”

I am using vimeowrap to loop through a playlist of videos. 我正在使用vimeowrap循环播放视频的播放列表。 I want the iframe that vimeowrap outputs to have a width and height of "100%" or "" nothing. 我希望vimeowrap输出的iframe的宽度和高度不为“ 100%”或“”。 Either will work. 两者都会起作用。

Vimeo Wrap : http://luwes.co/labs/vimeo-wrap/ Vimeo包装: http//luwes.co/labs/vimeo-wrap/

My Test Page: http://www.a3network.com/vimeo_wrap.html 我的测试页: http : //www.a3network.com/vimeo_wrap.html

Here is what I am testing. 这是我正在测试的。

<script>
    vimeowrap('player').setup({        
        urls: [
            'https://vimeo.com/16437160',
            'https://vimeo.com/16439781',
            'https://vimeo.com/16449483',
            'https://vimeo.com/16449643',
            'https://vimeo.com/16449980',
            'https://vimeo.com/16450347'
        ],
        width: '100%',
        height: '100%'
    });
</script>

I'm getting this output: 我得到以下输出:

<iframe width="100" height="100" frameborder="0" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" src="http://player.vimeo.com/video/16437160?api=1&amp;player_id=player_0" id="player_0" style="position: absolute; display: block;"></iframe>

I need this output: 我需要以下输出:

<iframe width="100%" height="100%" frameborder="0" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" src="http://player.vimeo.com/video/16437160?api=1&amp;player_id=player_0" id="player_0" style="position: absolute; display: block;"></iframe>

Any help, suggestions, clues, leads, hints are all very welcome and greatly appreciated. 任何帮助,建议,线索,线索,提示都非常受欢迎,也非常感谢。

It seems that vimeowrap doesn't support setting percentage heights/widths. 似乎vimeowrap不支持设置百分比高度/宽度。 You could simply change the style on the frame after it is added, for example (using JQuery): 添加后,您可以简单地更改框架上的样式,例如(使用JQuery):

vimeowrap('player').setup({        
    urls: [
        'https://vimeo.com/16437160',
        ...
    ]
});
$("#player").find(":iframe").css("width", "100%").css("height", "100%");

You can also look at the fiddle I used to try this out. 您也可以看看我用来尝试的小提琴

You could add a handler to the playlist and playerReady events and then resize the divs and iframe to be 100%: 您可以将处理程序添加到playlistplayerReady事件中,然后将div和iframe的大小调整为100%:

var player = vimeowrap('player').setup({
   ...
});

player.events.playlist.add(function() {
    player.container.style.height = '100%';
    player.container.style.width  = '100%';
    player.display.style.width    = '100%';
    player.display.style.height   = '100%';
});

player.events.playerReady.add(function() {
    player.iframe.width  = '100%';
    player.iframe.height = '100%';
});

Demo: http://jsfiddle.net/C5UTC/ 演示: http//jsfiddle.net/C5UTC/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM