0

我在我的页面中使用 jquery-oembed-all 来播放 youtube/vimeo 视频。它的大小比我需要的大一些或更大。我尝试更改class持有的 css 属性,a但它没有用。虽然我可以通过在 css 中iframe选择来更改高度和宽度。iframe但是玩家并没有缩小。还有一个向上和向下箭头符号来隐藏/取消隐藏 iframe 播放器,我不想在我的页面中使用它。如何根据需要自定义jquery-oembed-all

或者有没有其他替代方法可以实现这一目标?

任何帮助将不胜感激。谢谢!

html:

<div id="videos">
        <div id="video_wrapper">
            <div class="video_container">
                <a href="http://www.youtube.com/watch?v=hWnAqFyaQ5s" class="embed" class="video"></a>
                <p><a href="">This is the title</a></p>
                <p>2 days ago</p>
            </div>
            <div class="video_container">
                <a href="http://vimeo.com/86290699" class="embed video"></a>
                <p><a href="">This is the title</a></p>
                <p>2 days ago</p>
            </div>
        <div class="clear_left"></div>
        </div>
</div>

CSS:

#videos #video_wrapper .video_container .video {
    width: 180px;
}
4

1 回答 1

0

当您在 .js 文件中调用oembed()方法时,您可以指定一些设置。这里有一些默认设置:

$.fn.oembed.defaults = {
    maxWidth: null,
    maxHeight: null,
    includeHandle: true,
    embedMethod: 'auto',
    // "auto", "append", "fill"     
    onProviderNotFound: function() {},
    beforeEmbed: function() {},
    afterEmbed: function() {},
    onEmbed: false,
    onError: function() {},
    ajaxOptions: {}
};

如您所见,我们可以指定maxWidth,因此您的代码如下所示:

$('a.embed').oembed(null,{
   maxWidth: 180
});
于 2014-11-15T23:07:00.300 回答