1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/scss/_carousel.scss

250 lines
4.8 KiB
SCSS
Raw Normal View History

2012-06-29 00:46:45 -04:00
//
// Carousel
// --------------------------------------------------
// Wrapper for the slide container and indicators
.carousel {
position: relative;
}
.carousel-inner {
2012-09-26 14:20:27 -04:00
position: relative;
width: 100%;
overflow: hidden;
2014-12-17 21:30:16 -05:00
> .carousel-item {
position: relative;
display: none;
transition: .6s ease-in-out left;
// Account for jankitude on images
> img,
2013-01-31 12:04:12 -05:00
> a > img {
2015-03-11 15:19:03 -04:00
// @extend .img-responsive;
line-height: 1;
}
// WebKit CSS3 transforms for supported devices
@media all and (transform-3d), (-webkit-transform-3d) {
2014-11-30 23:29:47 -05:00
transition: transform .6s ease-in-out;
backface-visibility: hidden;
perspective: 1000;
2014-07-07 19:49:08 -04:00
&.next,
&.active.right {
left: 0;
transform: translate3d(100%, 0, 0);
}
2014-07-07 19:49:08 -04:00
&.prev,
&.active.left {
left: 0;
transform: translate3d(-100%, 0, 0);
}
2014-07-07 19:49:08 -04:00
&.next.left,
&.prev.right,
&.active {
left: 0;
transform: translate3d(0, 0, 0);
}
}
}
> .active,
> .next,
> .prev {
display: block;
}
> .active {
left: 0;
}
> .next,
> .prev {
position: absolute;
top: 0;
width: 100%;
}
> .next {
left: 100%;
}
> .prev {
left: -100%;
}
> .next.left,
> .prev.right {
left: 0;
}
> .active.left {
left: -100%;
}
> .active.right {
left: 100%;
}
}
// Left/right controls for nav
// ---------------------------
.carousel-control {
position: absolute;
2012-09-26 14:20:27 -04:00
top: 0;
bottom: 0;
left: 0;
2014-12-02 17:02:35 -05:00
width: $carousel-control-width;
font-size: $carousel-control-font-size;
color: $carousel-control-color;
text-align: center;
2014-12-02 17:02:35 -05:00
text-shadow: $carousel-text-shadow;
opacity: $carousel-control-opacity;
2013-10-24 22:20:08 -04:00
// We can't have this transition here because WebKit cancels the carousel
2013-07-01 20:32:07 -04:00
// animation if you trip this while in the middle of another animation.
2012-10-01 02:44:23 -04:00
// Set gradients for backgrounds
&.left {
2014-12-02 17:02:35 -05:00
@include gradient-horizontal($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
2012-10-01 02:44:23 -04:00
}
&.right {
2012-09-26 14:20:27 -04:00
right: 0;
left: auto;
2014-12-02 17:02:35 -05:00
@include gradient-horizontal($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
}
// Hover/focus state
@include hover-focus {
2014-12-02 17:02:35 -05:00
color: $carousel-control-color;
text-decoration: none;
outline: 0;
opacity: .9;
}
2012-10-01 02:44:23 -04:00
// Toggles
2013-07-18 03:48:02 -04:00
.icon-prev,
2014-07-08 03:33:21 -04:00
.icon-next {
2012-10-01 02:44:23 -04:00
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
width: 20px;
2014-07-08 03:33:21 -04:00
height: 20px;
margin-top: -10px;
font-family: serif;
Merge branch 'master' into v4 Conflicts: Gruntfile.js _config.yml dist/css/bootstrap-theme.css dist/css/bootstrap-theme.min.css dist/css/bootstrap.css dist/css/bootstrap.css.map dist/css/bootstrap.min.css dist/fonts/glyphicons-halflings-regular.eot dist/fonts/glyphicons-halflings-regular.svg dist/fonts/glyphicons-halflings-regular.ttf dist/fonts/glyphicons-halflings-regular.woff docs/_data/glyphicons.yml docs/_includes/components/alerts.html docs/_includes/components/badges.html docs/_includes/components/button-dropdowns.html docs/_includes/components/button-groups.html docs/_includes/components/dropdowns.html docs/_includes/components/glyphicons.html docs/_includes/components/input-groups.html docs/_includes/components/labels.html docs/_includes/components/media.html docs/_includes/components/navbar.html docs/_includes/components/navs.html docs/_includes/components/pagination.html docs/_includes/components/panels.html docs/_includes/components/progress-bars.html docs/_includes/css/buttons.html docs/_includes/css/forms.html docs/_includes/css/grid.html docs/_includes/css/helpers.html docs/_includes/css/images.html docs/_includes/css/less.html docs/_includes/css/responsive-utilities.html docs/_includes/css/sass.html docs/_includes/css/tables.html docs/_includes/css/type.html docs/_includes/getting-started/accessibility.html docs/_includes/getting-started/browser-device-support.html docs/_includes/getting-started/community.html docs/_includes/getting-started/download.html docs/_includes/getting-started/examples.html docs/_includes/getting-started/whats-included.html docs/_includes/js/affix.html docs/_includes/js/alerts.html docs/_includes/js/buttons.html docs/_includes/js/carousel.html docs/_includes/js/collapse.html docs/_includes/js/dropdowns.html docs/_includes/js/modal.html docs/_includes/js/overview.html docs/_includes/js/tabs.html docs/_includes/nav/components.html docs/_includes/nav/css.html docs/_includes/nav/javascript.html docs/_includes/nav/main.html docs/about.html docs/assets/css/docs.min.css docs/assets/js/customize.min.js docs/assets/js/raw-files.min.js docs/dist/css/bootstrap-theme.css docs/dist/css/bootstrap-theme.min.css docs/dist/css/bootstrap.css docs/dist/css/bootstrap.css.map docs/dist/css/bootstrap.min.css docs/dist/fonts/glyphicons-halflings-regular.eot docs/dist/fonts/glyphicons-halflings-regular.svg docs/dist/fonts/glyphicons-halflings-regular.ttf docs/dist/fonts/glyphicons-halflings-regular.woff docs/examples/carousel/index.html docs/examples/navbar-fixed-top/index.html docs/examples/navbar-static-top/index.html docs/examples/navbar/index.html docs/examples/non-responsive/index.html docs/examples/non-responsive/non-responsive.css docs/examples/sticky-footer-navbar/index.html docs/examples/theme/index.html fonts/glyphicons-halflings-regular.eot fonts/glyphicons-halflings-regular.svg fonts/glyphicons-halflings-regular.ttf fonts/glyphicons-halflings-regular.woff less/_carousel.less less/_forms.less less/glyphicons.less
2014-11-30 23:17:45 -05:00
line-height: 1;
}
2014-07-08 03:33:21 -04:00
.icon-prev {
left: 50%;
2014-03-31 04:37:55 -04:00
margin-left: -10px;
}
2014-07-08 03:33:21 -04:00
.icon-next {
right: 50%;
2014-03-31 04:37:55 -04:00
margin-right: -10px;
}
.icon-prev {
&:before {
content: "\2039";// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
}
}
.icon-next {
&:before {
content: "\203a";// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
}
}
}
2012-10-01 02:44:23 -04:00
// Optional indicator pips
//
// Add an unordered list with the following class and add a list item for each
// slide your carousel holds.
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
2013-05-16 21:29:53 -04:00
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none;
li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
cursor: pointer;
// IE9 hack for event handling
//
// Internet Explorer 9 does not support clicks on elements without a set
// `background-color`. We cannot use `filter` since that's not viewed as a
// background color by the browser. Thus, a hack is needed.
background-color: rgba(0,0,0,0); // IE9
border: 1px solid $carousel-indicator-border-color;
border-radius: 10px;
}
.active {
width: 12px;
height: 12px;
margin: 0;
2014-12-02 17:02:35 -05:00
background-color: $carousel-indicator-active-bg;
}
}
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
position: absolute;
right: 15%;
bottom: 20px;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
2014-12-02 17:02:35 -05:00
color: $carousel-caption-color;
text-align: center;
2014-12-02 17:02:35 -05:00
text-shadow: $carousel-text-shadow;
.btn {
2013-04-01 09:27:49 -04:00
text-shadow: none; // No shadow for button elements in carousel-caption
}
}
// Scale up controls for tablets and up
@include media-breakpoint-up(sm) {
// Scale up the controls a smidge
.carousel-control {
.icon-prev,
.icon-next {
width: 30px;
height: 30px;
margin-top: -15px;
font-size: 30px;
}
2014-03-31 04:37:55 -04:00
.icon-prev {
margin-left: -15px;
}
.icon-next {
margin-right: -15px;
}
}
// Show and left align the captions
.carousel-caption {
right: 20%;
left: 20%;
padding-bottom: 30px;
}
// Move up the indicators
.carousel-indicators {
bottom: 20px;
}
2014-12-02 17:02:35 -05:00
}