【发布时间】:2013-12-26 18:39:26
【问题描述】:
参考:Custom thumbnail or splash screen for embedded youtube video
另外,参考:http://lovesongforever.com;请注意在调整窗口大小时 Youtube 生成的缩略图大小会发生什么变化:
(a) 高度不变 (b) 左右两边的宽度夹子
这就是我想要发生的事情,它使用 Youtube 的缩略图使用宽度:100% 和固定高度:420px 来实现这一点
但是,当我只使用一个简单的图像(不是 youtube 嵌入视频)时,(a) 会发生......并且 (b) 右侧的宽度剪辑。
如何在我的图像上使用 CSS 执行 ORIGINAL a + b?
现有代码如下所示:
CSS:
.ls_video {
margin-left: auto;
margin-right: auto;
/*
width = 640px crops off just the right edge with window resizing.
width = 100% crops off both edges simultaneously with window resizing.
for the Youtube video, but NOT my image!
*/
width: 100%;
height: 420px;
text-align: left;
}
JS:
var videoSrc = "http://www.youtube.com/embed/MxuIrIZbbu0";
var videoParms = "?autoplay=1&fs=1&hd=1&wmode=transparent";
var youtubeVideo = "" +
"<iframe class='ls_video' src='" + videoSrc + videoParms + "'>" +
"</iframe>";
var theThumbNail = "" +
"<div onclick=\"this.innerHTML = youtubeVideo;\">" +
"<img class='ls_video' src='images/MLSFthumbnail.jpg' style='cursor:pointer' alt='splash' \/> " +
"</div>";
document.write (theThumbNail);
【问题讨论】:
-
您有什么代码可以用来诊断您的问题吗?
-
感谢您的提问...应该从一开始就添加示例代码
标签: css