gpt4 book ai didi

jquery - 轮播不在桌面上显示图像

转载 作者:行者123 更新时间:2023-11-28 16:34:22 24 4
gpt4 key购买 nike

我有一个工作正常的轮播。但是当我尝试降低轮播的高度时,整个图像并没有显示在轮播中(在桌面上)。在手机上它工作正常。

我不希望轮播覆盖整个页面。请全屏查看输出。

示例:

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
@import url('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
#carousel-example-generic .carousel-inner .item {
padding-bottom: 50%;
}
#carousel-example-generic .carousel-inner .first-item {
height: 100%;
width: 100%;
background: url('http://p1.pichost.me/i/13/1359503.jpg');
background-size: cover;
background-position: center;
}
#carousel-example-generic .carousel-inner .second-item {
height: 100%;
width: 100%;
background: url('http://all4desktop.com/data_images/1920%20x%201200/4211692-abstract-color-background-picture-8016.jpg');
background-size: cover;
background-position: center;
}
#carousel-example-generic .carousel-inner .third-item {
height: 100%;
width: 100%;
background: url('http://www.macwallhd.com/wp-content/Wallpapers/Abstract/Mac%20Wallpaper%20Spin%20The%20Apple%20Circle-575024442.jpeg');
background-size: cover;
background-position: center;
}
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<div id="carousel-example-generic" class="carousel slide slid" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active first-item">
<div class="carousel-caption">
...
</div>
</div>
<div class="item second-item">
<div class="carousel-caption">
...
</div>
</div>
<div class="item third-item">
<div class="carousel-caption">
...
</div>
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>

最佳答案

添加以下 CSS 设置一个 max-width,之后宽度与高度成比例限制:

#carousel-example-generic {
max-width: 960px;
margin: auto;
}

输出:http://output.jsbin.com/revecireyu/1

关于jquery - 轮播不在桌面上显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34826054/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com