【发布时间】:2012-11-03 06:11:28
【问题描述】:
我在 google chrome 中查看网页时遇到了一个奇怪的问题。在 ie9 / safari 中查看时,嵌入的 youtube 视频工作正常,但由于某种原因,在 chrome 中它只是在页面加载时显示一个黑框。奇怪的是页面与之交互的那一刻,即。用户向下滚动,视频将正确显示。我不确定出了什么问题。
有问题的页面是:http://core.slnmedia.com/inspiration/
页面上有一个脚本可以检测大图块右侧的可用宽度,如果有足够的空间,弹出面板将显示在右侧。如果没有,面板将显示在左侧。如果您调整浏览器窗口的大小,使“bevis 标记”图块位于屏幕的右上角,并且右侧只有少量可用空间,然后单击它,您会看到我的效果正在谈论。
改变磁贴位置的javascript函数如下:
$('.large-tile').hover(function() {
$(this).find('.bw-photo').hide();
$(this).find('.inspiration-detail-wrapper').show();
$(this).css("z-index", "2");
var profile = $(this).find('.inspiration-detail');
if(profile.find('.content').text().trim().length == 0) {
showData($(this).attr('id').substring(1, $(this).attr("id").length));
}
// **Depending on how much window space is available, position the panel on**left/right
var available = $(window).innerWidth() - ($(this).offset().left + 300);
if(available >= 412) {
// If enough space then show panel on right
profile.css("left", "320px");
}
else {
// Otherwise attach left
profile.css("left", "-368px");
}
profile.show();
$('.scrollbar-wrapper').tinyscrollbar({ size: 252 });
},
function() {
$(this).find('.bw-photo').show();
$(this).find('.profile').hide();
$(this).css("z-index", "1");
$(this).find('.inspiration-detail-wrapper').hide();
});
奇怪的是那行 profile.css("left", "320px");是什么导致了麻烦。如果您不包含此行,则视频将正确显示。由于某种原因,定位导致视频无法正确显示。
我希望我已经正确解释了这个问题 - 有人知道我在哪里出错了吗?快把我逼疯了!
谢谢
【问题讨论】:
标签: css google-chrome youtube