如何通过单击按钮强制启动轮播进入全屏模式? Here是一个工作示例,这是我的代码:
<div class="container">
<div class="well span9 columns">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<img src="http://bootstrapdocs.com/v2.0.3/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg" alt="" />
</div>
<div class="item">
<img src="http://bootstrapdocs.com/v2.0.3/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg" alt="" />
</div>
<div class="item">
<img src="http://bootstrapdocs.com/v2.0.3/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg" alt="" />
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
</div>
<button type="button" class="btn btn-inverse fulesize"><i class="icon-fullscreen icon-white"></i></button>
</div>
</div>
,jQuery是:
$(".fulesize").click(function(){
$(".carousel-inner, .carousel, .item, .active ").addClass("full");
});
和CSS:
html{height:100%;}
.full{height:100%;}
答案 0 :(得分:0)
我已经将它用于全尺寸背景图像,但我相信它也可以用于旋转木马。请参阅http://css-tricks.com/perfect-full-page-background-image/,根据您的需要更改课程。
$(window).load(function() {
var theWindow = $(window),
$bg = $("#bg"),
aspectRatio = $bg.width() / $bg.height();
function resizeBg() {
if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
$bg
.removeClass()
.addClass('bgheight');
} else {
$bg
.removeClass()
.addClass('bgwidth');
}
}
theWindow.resize(resizeBg).trigger("resize");
});