【问题标题】:Youtube video div overlay glitchYoutube 视频 div 覆盖故障
【发布时间】:2016-06-14 18:36:47
【问题描述】:

我正在尝试使用 div 覆盖视频,使其不可见。然后,当您将鼠标悬停在 div 上时,它的高度会缩小以使视频控件可见。

我不知道为什么会出现这个奇怪的故障:https://i.gyazo.com/aff58e50903009f7515a9cbd9b045f91.mp4

这是包含相关视频和叠加层的切片:

        <div class="ytsound-cover" ng-class="{'ytsound-cover-lower': hover, 'ytsound-cover': !hover}" ng-mouseenter="hover = true" ng-mouseleave="hover = false" id="cover">
        </div>
        <div id="ytsound">
            <iframe width="300" height="250" src="//www.youtube.com/embed/TbsBEb1ZxWA?autoplay=1&loop=1&playlist=TbsBEb1ZxWA&showinfo=0&start=65" frameborder="0" allowfullscreen></iframe>
        </div>

这里的风格:

.ytsound-cover{
        background: #fff;
        height: 250px;
        position: absolute;
        width: 301px;
}
.ytsound-cover-lower {
        background: #fff;
        height: 205px;
        position: absolute;
        width: 301px;
}

整个东西都加载在一个 ng-view 中。

但无论如何,这里是所有源代码,我将其托管在 github 上: https://github.com/Vacanor/gifsound

我很想指出为什么会发生这种情况。

PD:我不知道它是否有任何效果,但我使用 flexbox

【问题讨论】:

  • 您在哪个浏览器上遇到了这个故障?
  • 截至目前:Chrome、Opera、Firefox、Edge

标签: javascript html css angularjs


【解决方案1】:

尝试用另一个 div 包装这些 div,如下所示-

<div class="main-cover">    
<div class="ytsound-cover" id="cover"></div>
<div id="ytsound">
    <iframe width="300" height="250" src="//www.youtube.com/embed/TbsBEb1ZxWA?autoplay=1&loop=1&playlist=TbsBEb1ZxWA&showinfo=0&start=65" frameborder="0" allowfullscreen></iframe>
</div>

</div>    

让风格像-

.main-cover{
position:relative;
height:250px;
width:301px;
}
.ytsound-cover{
    background: #fff;
    height: 250px;
    position: absolute;
    width: 301px;
}
.main-cover:hover .ytsound-cover{
     height:205px
 }

【讨论】:

    猜你喜欢
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-29
    • 2012-06-20
    • 1970-01-01
    • 2018-10-05
    • 2021-05-09
    相关资源
    最近更新 更多