html - Trying to place a video in bootstrap carousel. But disappears when i set position to fixed -
im trying place video in bootstrap carosel. trying move video around fits div @ particular responsive hieght not dimensions of video itself.
but when make video position fixed disappears. i'm not sure whats going on here.
html
<video class="videoinsert" autoplay loop poster="~/content/video/posters/b-roll-1.jpg" muted> <source src="https://broken-links.com/tests/media/bigbuck.webm" type="video/webm"> <source src="https://broken-links.com/tests/media/bigbuck.m4v" type="video/mp4" /> browser not support video tag. </video> </div> </div> <a class="left carousel-control" href="#mycarousel" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span></a> <a class="right carousel-control" href="#mycarousel" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span></a> </div> <!-- /.carousel -->
css
#mycarousel { overflow: hidden; } .videoinsert { position: fixed; -webkit-transform: translatez(0); right: 0; bottom: 0; top: 0; margin-top: 0; min-width: 100%; min-height: 100%; width: 100%; height: 100%; background-size: cover; overflow: hidden; z-index: 1000;; }
and here fiddle:
i think why video "disappears": when make video fixed
new stacking context take out normal flow of be. since every element in carousel inside <div class="item">
, div doesn't have height (it grows according it's content), since video out of normal flow, div lose it's height.
here, updated demo: https://jsfiddle.net/f1fa1ksj/6/
i added fixed height div:
.item { height: 500px; }
also have keep in mind there several overflow: hidden;
properties in css of carousel, in: .carousel-inner
, #mycarousel
. can affect visibility of video depending on css apply it.
Comments
Post a Comment