I got the static images to resize but the video doesn't when the browser size is adjusted. This is probably because I've added a width into the script. However, if I just leave videoWidth: true,
then the video becomes tiny.
我得到静态图像来调整大小,但视频不会在调整浏览器大小时调整。这可能是因为我在脚本中添加了一个宽度。但是,如果我只是将videoWidth保留为true,则视频会变得很小。
On the website (http://imdarrien.com/work/Kami/kami.html)
在网站上(http://imdarrien.com/work/Kami/kami.html)
Here is the offical demo from the website (http://www.owlcarousel.owlgraphic.com/demos/video.html)
以下是该网站的官方演示(http://www.owlcarousel.owlgraphic.com/demos/video.html)
video:true,
videoHeight: 500,
videoWidth: 856,
.owl-carousel .owl-video-wrapper {
position: relative;
height: 100%;
background: #000;
}
.owl-carousel .owl-video-play-icon {
position: absolute;
height: 80px;
width: 80px;
left: 50%;
top: 50%;
margin-left: -40px;
margin-top: -40px;
background: url(play_button.png) no-repeat;
cursor: pointer;
z-index: 1;
-webkit-backface-visibility: hidden;
opacity:1;
transition: all 1s;
}
当videoWidth:false时
2 个解决方案
#1
9
By adding "responsive:true" option and changing video tag width 100%;height:auto you can get video as responsive.
通过添加“responsive:true”选项并更改视频标签宽度100%;高度:自动,您可以获得视频响应。
Demo: http://jsfiddle.net/nLz17fcv/5/
script:
$(document).ready(function() {
$("#carousel").owlCarousel({
items:1,
autoPlay : 5500,
stopOnHover : true,
center:true,
navigation:false,
pagination:false,
goToFirstSpeed : 1300,
singleItem : true,
autoHeight : true,
responsive: true,
responsiveRefreshRate : 200,
responsiveBaseWidth: window,
video:true,
transitionStyle:"fade",
onTranslate: function() {
$('.owl-item').find('video').each(function() {
this.pause();
});
}
});
})
CSS
.owl-carousel {width:90%; margin: 0 auto;}
.owl-carousel img{width:100%;height:auto;}
#2
1
I completely agree that the addition of "responsive:true" option and changing the video tag width to 100%;height:auto you are able to get video as responsive.
我完全同意添加“responsive:true”选项并将视频标签宽度更改为100%;高度:自动您可以获得视频响应。
#1
9
By adding "responsive:true" option and changing video tag width 100%;height:auto you can get video as responsive.
通过添加“responsive:true”选项并更改视频标签宽度100%;高度:自动,您可以获得视频响应。
Demo: http://jsfiddle.net/nLz17fcv/5/
script:
$(document).ready(function() {
$("#carousel").owlCarousel({
items:1,
autoPlay : 5500,
stopOnHover : true,
center:true,
navigation:false,
pagination:false,
goToFirstSpeed : 1300,
singleItem : true,
autoHeight : true,
responsive: true,
responsiveRefreshRate : 200,
responsiveBaseWidth: window,
video:true,
transitionStyle:"fade",
onTranslate: function() {
$('.owl-item').find('video').each(function() {
this.pause();
});
}
});
})
CSS
.owl-carousel {width:90%; margin: 0 auto;}
.owl-carousel img{width:100%;height:auto;}
#2
1
I completely agree that the addition of "responsive:true" option and changing the video tag width to 100%;height:auto you are able to get video as responsive.
我完全同意添加“responsive:true”选项并将视频标签宽度更改为100%;高度:自动您可以获得视频响应。