【发布时间】:2018-09-02 13:44:23
【问题描述】:
到目前为止,我已经检查了以下问题/答案...
a: add scrolling="no" to iframe 和
b: add "?wmode=opaque" to the iframe source link
这两个问题都很老了,但我尝试了一个,然后是另一个,然后是两个,以及其他几个我知道不会工作的 cmets 提供的解决方案。
<!-- YOUTUBE -->
<div class="row containerStyle" style="position: relative;">
<div class="col-sm-12">
<div class="badge badge-pill pillStyle">
<span class="ytImage">
<span class="g-ytsubscribe text-left" data-channel="xyz" data-layout="default" data-count="default">
<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="xyz" data-layout="default" data-count="default"></div>
</span>
</span>
<a href="https://www.youtube.com/user/xyz" class="viewAll">VIEW ALL <span class="vaArrow">→</span></a>
</div>
<div id="youtubeWrap">
<p id="youtubeLabel">ORIGINAL CHOREOGRAPHY<br /> <span id="subytLabel">by: XYZ <br />SONG ft. Artist, Another Guy, DJ Someone</span></p>
<img src="./images/rip2.png" class="ytimageStyle" />
<iframe id="arrowLink" class="anIframe" src="https://www.youtube.com/embed/-xyz?wmode=opaque;rel=0&controls=0&showinfo=0" frameborder="0" scrolling="no" allowfullscreen></iframe>
</div>
</div>
</div>
我的 CSS:
#youtubeWrap {
position: relative;
overflow: hidden;
}
#youtubeWrap iframe, #youtubeWrap object, #youtubeWrap embed {
-moz-transition: all 0.5s;
-webkit-transition: all 0.5s;
transition: all 0.5s;
}
#youtubeWrap iframe:hover, #youtubeWrap object:hover, #youtubeWrap embed:hover {
-moz-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
#youtubeLabel {
color: #FFFFFF;
position: absolute;
z-index: 12;
top: 50%;
left: 3%;
font-weight: 300;
width: 35%;
font-size: 20px;
overflow: hidden;
}
#subytLabel {
font-size: 14px;
}
.ytImage {
height: 25px;
float: left;
padding: 0 15px;
}
.ytimageStyle {
z-index: 10;
position: relative;
height: 100%;
width: 40%;
}
.anIframe {
width: 70%;
height: 100%;
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
我想要完成的是,当用户将鼠标悬停在视频上时,视频会略微放大。但是,我不希望溢出可见。正如我在这里拥有的那样,它“大部分”时间都在工作。如果您反复将鼠标悬停和鼠标移出,溢出将显示大约 1/10 的时间,有时会卡住。我已经进行了大量的尽职调查,但未能找到适合这里的解决方案。
编辑:这张图片是怎么回事,它似乎只是 Chrome 中的一个问题。
EDIT(2):我刚刚发现了四年前的另一个问题。仍然有点旧,没有什么对我有用,但它是最近的,我想分享所有东西以防我错过了什么。
【问题讨论】:
-
这是一个精简的小提琴:jsfiddle.net/hoxv2ghg/13 正如 Eric 的编辑所说,在 FF 中工作,但 Chrome 似乎在转换完成后进行了一些重新计算。