自动将 Vimeo 视频缩放至页面高度的 100%

发布于 2024-12-01 10:08:18 字数 207 浏览 0 评论 0原文

大家好: 你们中有人知道一种获取 vimeo 嵌入代码并使其缩放到页面 100% 的方法吗?这是我想要做的事情的一个例子。

http://player.vimeo.com/video/4643702

请告诉我!

谢谢

Hi There: Are any of you aware of a method for taking the vimeo embed code and making it scale to 100% of a page? Here is an example of what I'm looking to do.

http://player.vimeo.com/video/4643702

Please let me know!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抚笙 2024-12-08 10:08:18

设置 width="100%" 会将您的高度设置为您在大多数情况下想要的更小值。并且设置 height="100%" 将不会保留您的纵横比。

我建议你做什么:

  1. 将位置设置为固定或绝对(看看什么最适合你)
  2. 将宽度和高度设置为与视频文件相同,
  3. 在文档上使用 JS 或 jQuery。准备好设置使用的宽高比
    他的属性 width 和 height
  4. 将其宽度设置为屏幕的 100%
  5. 将其高度设置为 width ,乘以上面的 handel window.resize 事件中的 宽高比
  6. ,因为也许在某些情况下宽度将小于高度,因此您必须将高度设置为 100% 并重新计算宽度

Setting width="100%" will set your height to something smaller that you want in most cases. And setting height="100%" will not preserve your aspect ratio.

What I suggest you do:

  1. set position of to fixed or absolute (see what suites you the most)
  2. set width and height of to the same as video file is
  3. use JS or jQuery on document.ready to set aspect ratio for using
    his attributes width and height
  4. set it's width to 100% of the screen
  5. set it's height to width that multiplies aspect ratio from above
  6. handel window.resize event, because maybe in some cases width will be smallet than height so you must set height to 100% and recalculate the width
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文