jquery - Carousel not displaying images on desktop -
i have carousel working fine. when try reduce height of carousel, whole image not being displayed in carousel (on desktop). on mobile works fine.
i don't want carousel cover whole page. please see output in full screen.
example:
@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>
adding following css sets max-width
, after width limited proportionally height:
#carousel-example-generic { max-width: 960px; margin: auto; }
Comments
Post a Comment