0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Bootstrap/scss/_carousel.scss

254 lines
5.2 KiB
SCSS
Raw Normal View History

// Wrapper for the slide container and indicators
.carousel {
position: relative;
}
.carousel-inner {
2012-09-26 20:20:27 +02:00
position: relative;
width: 100%;
overflow: hidden;
2014-12-18 03:30:16 +01:00
> .carousel-item {
position: relative;
display: none;
transition: .6s ease-in-out left;
// Account for jankitude on images
> img,
2013-01-31 18:04:12 +01:00
> a > img {
@extend .img-fluid;
line-height: 1;
}
// CSS3 transforms when supported by the browser
@include if-supports-3d-transforms() {
2014-12-01 05:29:47 +01:00
transition: transform .6s ease-in-out;
backface-visibility: hidden;
2015-06-19 08:56:43 +02:00
perspective: 1000px;
2014-07-08 01:49:08 +02:00
&.next,
&.active.right {
left: 0;
transform: translate3d(100%, 0, 0);
}
2014-07-08 01:49:08 +02:00
&.prev,
&.active.left {
left: 0;
transform: translate3d(-100%, 0, 0);
}
2014-07-08 01:49:08 +02: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%;
}
}
2015-04-18 20:17:28 +02:00
//
// Left/right controls for nav
2015-04-18 20:17:28 +02:00
//
.carousel-control {
position: absolute;
2012-09-26 20:20:27 +02:00
top: 0;
bottom: 0;
left: 0;
2014-12-02 23:02:35 +01:00
width: $carousel-control-width;
font-size: $carousel-control-font-size;
color: $carousel-control-color;
text-align: center;
2014-12-02 23:02:35 +01:00
text-shadow: $carousel-text-shadow;
opacity: $carousel-control-opacity;
2013-10-25 04:20:08 +02:00
// We can't have this transition here because WebKit cancels the carousel
2013-07-02 02:32:07 +02:00
// animation if you trip this while in the middle of another animation.
2012-10-01 08:44:23 +02:00
// Set gradients for backgrounds
&.left {
@include gradient-x($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
2012-10-01 08:44:23 +02:00
}
&.right {
2012-09-26 20:20:27 +02:00
right: 0;
left: auto;
@include gradient-x($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
}
// Hover/focus state
@include hover-focus {
2014-12-02 23:02:35 +01:00
color: $carousel-control-color;
text-decoration: none;
outline: 0;
opacity: .9;
}
2012-10-01 08:44:23 +02:00
// Toggles
2013-07-18 09:48:02 +02:00
.icon-prev,
2014-07-08 09:33:21 +02:00
.icon-next {
2012-10-01 08:44:23 +02:00
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
width: $carousel-icon-width;
height: $carousel-icon-width;
margin-top: -($carousel-icon-width / 2);
2014-07-08 09:33:21 +02:00
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-12-01 05:17:45 +01:00
line-height: 1;
}
2014-07-08 09:33:21 +02:00
.icon-prev {
left: 50%;
margin-left: -($carousel-icon-width / 2);
}
2014-07-08 09:33:21 +02:00
.icon-next {
right: 50%;
margin-right: -($carousel-icon-width / 2);
}
2014-03-31 10:37:55 +02:00
.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 08:44:23 +02:00
2015-04-18 20:17:28 +02: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-17 03:29:53 +02:00
z-index: 15;
width: $carousel-indicators-width;
padding-left: 0;
margin-left: -($carousel-indicators-width / 2);
text-align: center;
list-style: none;
li {
display: inline-block;
width: $carousel-indicator-size;
height: $carousel-indicator-size;
margin: 1px;
text-indent: -999px;
cursor: pointer;
// IE9 hack for event handling
//
// Internet Explorer 9 does not properly handle clicks on elements with a `background-color` of `transparent`,
// so we use `rgba(0,0,0,0)` instead since it's a non-buggy equivalent.
// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer
background-color: rgba(0,0,0,0); // IE9
border: 1px solid $carousel-indicator-border-color;
border-radius: $carousel-indicator-size;
}
.active {
width: $carousel-indicator-active-size;
height: $carousel-indicator-active-size;
margin: 0;
2014-12-02 23:02:35 +01:00
background-color: $carousel-indicator-active-bg;
}
}
2015-04-18 20:17:28 +02:00
// Optional captions
2015-04-18 20:17:28 +02:00
//
// Hidden by default for smaller viewports.
.carousel-caption {
position: absolute;
right: ((100% - $carousel-caption-width) / 2);
bottom: 20px;
left: ((100% - $carousel-caption-width) / 2);
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
2014-12-02 23:02:35 +01:00
color: $carousel-caption-color;
text-align: center;
2014-12-02 23:02:35 +01:00
text-shadow: $carousel-text-shadow;
.btn {
2013-04-01 15:27:49 +02:00
text-shadow: none; // No shadow for button elements in carousel-caption
}
}
2015-04-18 20:17:28 +02:00
//
// Responsive variations
//
@include media-breakpoint-up(sm) {
// Scale up the controls a smidge
.carousel-control {
.icon-prev,
.icon-next {
width: $carousel-control-sm-up-size;
height: $carousel-control-sm-up-size;
margin-top: -($carousel-control-sm-up-size / 2);
font-size: $carousel-control-sm-up-size;
}
2014-03-31 10:37:55 +02:00
.icon-prev {
margin-left: -($carousel-control-sm-up-size / 2);
2014-03-31 10:37:55 +02:00
}
.icon-next {
margin-right: -($carousel-control-sm-up-size / 2);
2014-03-31 10:37:55 +02:00
}
}
// Show and left align the captions
.carousel-caption {
right: ((100% - $carousel-caption-sm-up-width) / 2);
left: ((100% - $carousel-caption-sm-up-width) / 2);
padding-bottom: 30px;
}
// Move up the indicators
.carousel-indicators {
bottom: 20px;
}
2014-12-02 23:02:35 +01:00
}