mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-10 22:24:19 +01:00
Re-add carousel captions as optional
* They're hidden by default in the mobile-first views because otherwise they just cover up the slides * In mobile they're centered, and then are shown left aligned at larger viewports
This commit is contained in:
parent
e74fb39080
commit
6d048471c4
74
docs/assets/css/bootstrap.css
vendored
74
docs/assets/css/bootstrap.css
vendored
@ -4437,7 +4437,6 @@ a.counter:focus {
|
|||||||
|
|
||||||
.carousel {
|
.carousel {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.carousel-inner {
|
.carousel-inner {
|
||||||
@ -4504,19 +4503,23 @@ a.counter:focus {
|
|||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 120px;
|
width: 15%;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
filter: alpha(opacity=50);
|
filter: alpha(opacity=50);
|
||||||
}
|
}
|
||||||
|
|
||||||
.carousel-control.left {
|
.carousel-control.left {
|
||||||
background-color: rgba(0, 0, 0, 0.001);
|
background-color: rgba(0, 0, 0, 0.0001);
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
|
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001));
|
||||||
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.001)));
|
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001)));
|
||||||
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
|
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001));
|
||||||
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
|
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001));
|
||||||
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001));
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
|
||||||
}
|
}
|
||||||
@ -4526,11 +4529,11 @@ a.counter:focus {
|
|||||||
left: auto;
|
left: auto;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
|
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.0001), rgba(0, 0, 0, 0.5));
|
||||||
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0.001)), to(rgba(0, 0, 0, 0.5)));
|
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5)));
|
||||||
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
|
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001), rgba(0, 0, 0, 0.5));
|
||||||
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
|
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001), rgba(0, 0, 0, 0.5));
|
||||||
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001), rgba(0, 0, 0, 0.5));
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
|
||||||
}
|
}
|
||||||
@ -4543,28 +4546,21 @@ a.counter:focus {
|
|||||||
filter: alpha(opacity=90);
|
filter: alpha(opacity=90);
|
||||||
}
|
}
|
||||||
|
|
||||||
.carousel-control .carousel-control .glyphicon-chevron-left,
|
.carousel-control .glyphicon {
|
||||||
.carousel-control .carousel-control .glyphicon-chevron-right {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
margin-left: 20px;
|
margin-left: -10px;
|
||||||
font-size: 20px;
|
|
||||||
color: #fff;
|
|
||||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.carousel-control .carousel-control .glyphicon-chevron-right {
|
|
||||||
margin-left: 80px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.carousel-indicators {
|
.carousel-indicators {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 15px;
|
bottom: 20px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
@ -4589,17 +4585,37 @@ a.counter:focus {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.carousel-caption {
|
||||||
|
position: absolute;
|
||||||
|
right: 20%;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 20%;
|
||||||
|
display: none;
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.carousel-control .glyphicon-chevron-left,
|
.carousel-control .glyphicon {
|
||||||
.carousel-control .glyphicon-chevron-right {
|
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-top: -15px;
|
margin-top: -15px;
|
||||||
margin-left: 30px;
|
margin-left: -15px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
.carousel-control .glyphicon-chevron-right {
|
.carousel-caption {
|
||||||
margin-left: 70px;
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
display: block;
|
||||||
|
max-width: 60%;
|
||||||
|
padding: 30px;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: 0;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// carousel demo
|
// carousel demo
|
||||||
$('#myCarousel').carousel()
|
$('.bs-docs-carousel-example').carousel()
|
||||||
|
|
||||||
// javascript build logic
|
// javascript build logic
|
||||||
var inputsComponent = $("#components.download input")
|
var inputsComponent = $("#components.download input")
|
||||||
|
@ -1470,10 +1470,10 @@ $('#myCollapsible').on('hidden', function () {
|
|||||||
<h1>Carousel <small>bootstrap-carousel.js</small></h1>
|
<h1>Carousel <small>bootstrap-carousel.js</small></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Example carousel</h2>
|
<h2>Examples</h2>
|
||||||
<p>The slideshow below shows a generic plugin and component for cycling through elements like a carousel.</p>
|
<p>The slideshow below shows a generic plugin and component for cycling through elements like a carousel.</p>
|
||||||
<div class="bs-docs-example">
|
<div class="bs-docs-example">
|
||||||
<div id="myCarousel" class="carousel slide">
|
<div class="carousel slide bs-docs-carousel-example">
|
||||||
<ol class="carousel-indicators">
|
<ol class="carousel-indicators">
|
||||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
<li data-target="#myCarousel" data-slide-to="1"></li>
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
@ -1499,7 +1499,7 @@ $('#myCollapsible').on('hidden', function () {
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- /example -->
|
</div><!-- /example -->
|
||||||
{% highlight html linenos %}
|
{% highlight html linenos %}
|
||||||
<div id="myCarousel" class="carousel slide">
|
<div class="carousel slide">
|
||||||
<!-- Indicators -->
|
<!-- Indicators -->
|
||||||
<ol class="carousel-indicators">
|
<ol class="carousel-indicators">
|
||||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
@ -1520,18 +1520,64 @@ $('#myCollapsible').on('hidden', function () {
|
|||||||
|
|
||||||
<!-- Controls -->
|
<!-- Controls -->
|
||||||
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
|
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
|
||||||
<span class="control">‹</span>
|
<span class="glyphicon glyphicon-chevron-left"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="right carousel-control" href="#myCarousel" data-slide="next">
|
<a class="right carousel-control" href="#myCarousel" data-slide="next">
|
||||||
<span class="control">›</span>
|
<span class="glyphicon glyphicon-chevron-right"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<div class="alert alert-warning">
|
<h3>Optional captions</h3>
|
||||||
<strong>Heads up!</strong>
|
<p>Add captions to your slides easily with the <code>.carousel-caption</code> element within any <code>.item</code>. Place just about any optional HTML within there and it will be automatically aligned and formatted.</p>
|
||||||
When implementing this carousel, remove the images we have provided and replace them with your own.
|
<div class="bs-docs-example">
|
||||||
|
<div class="carousel slide bs-docs-carousel-example">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner">
|
||||||
|
<div class="item active">
|
||||||
|
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
|
||||||
|
<div class="carousel-caption">
|
||||||
|
<h3>First slide label</h3>
|
||||||
|
<p>Nulla vitae elit libero, a pharetra augue. Maecenas faucibus mollis interdum. Cum sociis natoque penatibus et magnis dis parturient montes.</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
|
||||||
|
<div class="carousel-caption">
|
||||||
|
<h3>Second slide label</h3>
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
|
||||||
|
<div class="carousel-caption">
|
||||||
|
<h3>Third slide label</h3>
|
||||||
|
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
</div><!-- /example -->
|
||||||
|
{% highlight html linenos %}
|
||||||
|
<div class="item active">
|
||||||
|
<img src="..." alt="">
|
||||||
|
<div class="carousel-caption">
|
||||||
|
<h3>...</h3>
|
||||||
|
<p>...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<hr class="bs-docs-separator">
|
<hr class="bs-docs-separator">
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
// Wrapper for the slide container and indicators
|
// Wrapper for the slide container and indicators
|
||||||
.carousel {
|
.carousel {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap all slides, but only show the active one
|
// Wrap all slides, but only show the active one
|
||||||
@ -75,8 +74,12 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 120px;
|
width: 15%;
|
||||||
.opacity(50);
|
.opacity(50);
|
||||||
|
font-size: 20px;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 2px rgba(0,0,0,.6);
|
||||||
|
|
||||||
// we can't have this transition here
|
// we can't have this transition here
|
||||||
// because webkit cancels the carousel
|
// because webkit cancels the carousel
|
||||||
@ -87,13 +90,13 @@
|
|||||||
|
|
||||||
// Set gradients for backgrounds
|
// Set gradients for backgrounds
|
||||||
&.left {
|
&.left {
|
||||||
#gradient > .horizontal(rgba(0,0,0,.5), rgba(0,0,0,.001));
|
#gradient > .horizontal(rgba(0,0,0,.5), rgba(0,0,0,.0001));
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
&.right {
|
&.right {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: 0;
|
right: 0;
|
||||||
#gradient > .horizontal(rgba(0,0,0,.001), rgba(0,0,0,.5));
|
#gradient > .horizontal(rgba(0,0,0,.0001), rgba(0,0,0,.5));
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,30 +109,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Toggles
|
// Toggles
|
||||||
.carousel-control .glyphicon-chevron-left,
|
.glyphicon {
|
||||||
.carousel-control .glyphicon-chevron-right {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
margin-left: 20px;
|
margin-left: -10px;
|
||||||
font-size: 20px;
|
|
||||||
color: #fff;
|
|
||||||
text-shadow: 0 1px 2px rgba(0,0,0,.6);
|
|
||||||
}
|
|
||||||
.carousel-control .glyphicon-chevron-right {
|
|
||||||
margin-left: 80px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carousel indicator pips
|
// Optional indicator pips
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
.carousel-indicators {
|
.carousel-indicators {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 15px;
|
bottom: 20px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
@ -153,20 +150,45 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optional captions
|
||||||
|
// -----------------------------
|
||||||
|
// Hidden by default for smaller viewports
|
||||||
|
.carousel-caption {
|
||||||
|
position: absolute;
|
||||||
|
left: 20%;
|
||||||
|
right: 20%;
|
||||||
|
bottom: 20px;
|
||||||
|
display: none;
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 2px rgba(0,0,0,.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Scale up controls for >768px
|
// Scale up controls for >768px
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
|
|
||||||
.carousel-control .glyphicon-chevron-left,
|
// Scale up the controls a smidge
|
||||||
.carousel-control .glyphicon-chevron-right {
|
.carousel-control .glyphicon {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-top: -15px;
|
margin-top: -15px;
|
||||||
margin-left: 30px;
|
margin-left: -15px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
.carousel-control .glyphicon-chevron-right {
|
|
||||||
margin-left: 70px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Show and left align the captions
|
||||||
|
.carousel-caption {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 10;
|
||||||
|
display: block;
|
||||||
|
max-width: 60%;
|
||||||
|
padding: 30px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user