0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-30 22:52:24 +01:00

Overhaul carousel a bit more:

* Drop custom type arrow controls for glyphicons icons instead for more consistent rendering
* Remove the captions and instead let folks implement what they want in the carousel
* Move the indicators to the bottom middle instead of top right
* Lighten up gradients on the edges for less harsh lighting
This commit is contained in:
Mark Otto 2013-02-16 01:22:15 -08:00
parent b688d8dcd4
commit d8e2668c1d
5 changed files with 90 additions and 117 deletions

View File

@ -6,7 +6,6 @@ pygments: true
permalink: pretty permalink: pretty
# Server # Server
auto: true
source: ./docs source: ./docs
destination: ./_gh_pages destination: ./_gh_pages
url: http://bootstrap.dev:9001 url: http://bootstrap.dev:9001

View File

@ -18,7 +18,6 @@
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="/assets/js/holder/holder.js"></script> <script src="/assets/js/holder/holder.js"></script>
<script src="/assets/js/google-code-prettify/prettify.js"></script>
<script src="/assets/js/application.js"></script> <script src="/assets/js/application.js"></script>

View File

@ -4437,7 +4437,6 @@ a.counter:focus {
.carousel { .carousel {
position: relative; position: relative;
margin-bottom: 20px;
line-height: 1; line-height: 1;
} }
@ -4513,27 +4512,27 @@ a.counter:focus {
.carousel-control.left { .carousel-control.left {
background-color: rgba(0, 0, 0, 0.001); background-color: rgba(0, 0, 0, 0.001);
background-color: transparent; background-color: transparent;
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.001)); background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0.75)), 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.001)));
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.001)); background-image: -webkit-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.75), rgba(0, 0, 0, 0.001)); background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.001)); background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.001));
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf000000', endColorstr='#00000000', GradientType=1); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
} }
.carousel-control.right { .carousel-control.right {
right: 0; right: 0;
left: auto; left: auto;
background-color: rgba(0, 0, 0, 0.75); 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.75)); background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.001), 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.75))); 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-linear-gradient(left, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.75)); background-image: -webkit-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.001), rgba(0, 0, 0, 0.75)); background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.75)); background-image: linear-gradient(to right, rgba(0, 0, 0, 0.001), rgba(0, 0, 0, 0.5));
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#bf000000', GradientType=1); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
} }
.carousel-control:hover, .carousel-control:hover,
@ -4544,42 +4543,45 @@ a.counter:focus {
filter: alpha(opacity=90); filter: alpha(opacity=90);
} }
.carousel-control .control { .carousel-control .carousel-control .glyphicon-chevron-left,
.carousel-control .carousel-control .glyphicon-chevron-right {
position: absolute; position: absolute;
top: 50%; top: 50%;
z-index: 5; z-index: 5;
display: block; display: inline-block;
margin-top: -35px; width: 20px;
margin-left: 30px; height: 20px;
font-size: 80px; margin-top: -10px;
font-weight: 100; margin-left: 20px;
font-size: 20px;
color: #fff; color: #fff;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
} }
.carousel-control.right .control { .carousel-control .carousel-control .glyphicon-chevron-right {
margin-left: 70px; margin-left: 80px;
} }
.carousel-indicators { .carousel-indicators {
position: absolute; position: absolute;
top: 15px; bottom: 15px;
right: 15px; left: 50%;
z-index: 5; z-index: 5;
margin: 0; width: 100px;
margin: 0 0 0 -50px;
text-align: center;
list-style: none; list-style: none;
} }
.carousel-indicators li { .carousel-indicators li {
display: block; display: inline-block;
float: left; width: 8px;
width: 10px; height: 8px;
height: 10px; margin-right: 0;
margin-left: 5px; margin-left: 0;
text-indent: -999px; text-indent: -999px;
cursor: pointer; cursor: pointer;
background-color: #ccc; border: 1px solid #fff;
background-color: rgba(255, 255, 255, 0.25);
border-radius: 5px; border-radius: 5px;
} }
@ -4587,29 +4589,18 @@ a.counter:focus {
background-color: #fff; background-color: #fff;
} }
.carousel-caption { @media screen and (min-width: 768px) {
position: absolute; .carousel-control .glyphicon-chevron-left,
right: 0; .carousel-control .glyphicon-chevron-right {
bottom: 0; width: 30px;
left: 0; height: 30px;
z-index: 10; margin-top: -15px;
max-width: 60%; margin-left: 30px;
padding: 40px; font-size: 30px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
} .carousel-control .glyphicon-chevron-right {
margin-left: 70px;
.carousel-caption h3, }
.carousel-caption p {
line-height: 20px;
color: #fff;
}
.carousel-caption h3 {
margin: 0 0 5px;
}
.carousel-caption p {
margin-bottom: 0;
} }
.jumbotron { .jumbotron {

View File

@ -1481,32 +1481,20 @@ $('#myCollapsible').on('hidden', function () {
</ol> </ol>
<div class="carousel-inner"> <div class="carousel-inner">
<div class="item active"> <div class="item active">
<img src="assets/img/bootstrap-mdo-sfmoma-01.jpg" alt=""> <img data-src="holder.js/900x500/auto/#777:#fff/text:First slide" 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"> <div class="item">
<img src="assets/img/bootstrap-mdo-sfmoma-02.jpg" alt=""> <img data-src="holder.js/900x500/auto/#777:#fff/text:Second slide" 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>
<div class="item"> <div class="item">
<img src="assets/img/bootstrap-mdo-sfmoma-03.jpg" alt=""> <img data-src="holder.js/900x500/auto/#777:#fff/text:Third slide" 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>
</div> </div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"> <a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="control">&lsaquo;</span> <span class="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">&rsaquo;</span> <span class="glyphicon-chevron-right"></span>
</a> </a>
</div> </div>
</div><!-- /example --> </div><!-- /example -->

View File

@ -3,18 +3,20 @@
// -------------------------------------------------- // --------------------------------------------------
// Wrapper for the slide container and indicators
.carousel { .carousel {
position: relative; position: relative;
margin-bottom: @line-height-base;
line-height: 1; line-height: 1;
} }
// Wrap all slides, but only show the active one
.carousel-inner { .carousel-inner {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
} }
// Immediate parent of all slides
.carousel-inner { .carousel-inner {
> .item { > .item {
@ -85,13 +87,13 @@
// Set gradients for backgrounds // Set gradients for backgrounds
&.left { &.left {
#gradient > .horizontal(rgba(0,0,0,.75), rgba(0,0,0,.001)); #gradient > .horizontal(rgba(0,0,0,.5), rgba(0,0,0,.001));
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,.75)); #gradient > .horizontal(rgba(0,0,0,.001), rgba(0,0,0,.5));
background-color: transparent; background-color: transparent;
} }
@ -104,20 +106,22 @@
} }
// Toggles // Toggles
.control { .carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
position: absolute; position: absolute;
top: 50%; top: 50%;
z-index: 5; z-index: 5;
display: block; display: inline-block;
margin-top: -35px; width: 20px;
margin-left: 30px; height: 20px;
font-size: 80px; margin-top: -10px;
font-weight: 100; margin-left: 20px;
font-size: 20px;
color: #fff; color: #fff;
text-shadow: 0 1px 2px rgba(0,0,0,.6); text-shadow: 0 1px 2px rgba(0,0,0,.6);
} }
&.right .control { .carousel-control .glyphicon-chevron-right {
margin-left: 70px; margin-left: 80px;
} }
} }
@ -125,21 +129,22 @@
// ----------------------------- // -----------------------------
.carousel-indicators { .carousel-indicators {
position: absolute; position: absolute;
top: 15px; bottom: 15px;
right: 15px; left: 50%;
z-index: 5; z-index: 5;
margin: 0; width: 100px;
margin: 0 0 0 -50px;
list-style: none; list-style: none;
text-align: center;
li { li {
display: block; display: inline-block;
float: left; width: 8px;
width: 10px; height: 8px;
height: 10px; margin-left: 0;
margin-left: 5px; margin-right: 0;
text-indent: -999px; text-indent: -999px;
background-color: #ccc; border: 1px solid #fff;
background-color: rgba(255,255,255,.25);
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
} }
@ -149,28 +154,19 @@
} }
// Caption for text below images // Scale up controls for >768px
// ----------------------------- @media screen and (min-width: 768px) {
.carousel-caption { .carousel-control .glyphicon-chevron-left,
position: absolute; .carousel-control .glyphicon-chevron-right {
left: 0; width: 30px;
right: 0; height: 30px;
bottom: 0; margin-top: -15px;
z-index: 10; margin-left: 30px;
padding: 40px; font-size: 30px;
text-shadow: 0 1px 2px rgba(0,0,0,.6); }
max-width: 60%; .carousel-control .glyphicon-chevron-right {
margin-left: 70px;
}
h3,
p {
color: #fff;
line-height: @line-height-base;
}
h3 {
margin: 0 0 5px;
}
p {
margin-bottom: 0;
}
} }