Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4: Flexbox carousel options #21400

Merged
merged 5 commits into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions scss/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
display: block;
display: flex;
}

.carousel-item-next,
Expand Down Expand Up @@ -61,6 +61,10 @@
position: absolute;
top: 0;
bottom: 0;
// Use flex for alignment (1-3)
display: flex; // 1. allow flex styles
align-items: center; // 2. vertically center contents
justify-content: center; // 3. horizontally center contents
width: $carousel-control-width;
color: $carousel-control-color;
text-align: center;
Expand All @@ -86,26 +90,16 @@
// Icons for within
.carousel-control-prev-icon,
.carousel-control-next-icon {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
width: $carousel-control-icon-width;
height: $carousel-control-icon-width;
margin-top: -($carousel-control-icon-width / 2);
font-family: serif;
line-height: 1;
background: transparent no-repeat center center;
background-size: 100% 100%;
}
.carousel-control-prev-icon {
left: 50%;
margin-left: -($carousel-control-icon-width / 2);
background-image: $carousel-control-prev-icon-bg;
}
.carousel-control-next-icon {
right: 50%;
margin-right: -($carousel-control-icon-width / 2);
background-image: $carousel-control-next-icon-bg;
}

Expand All @@ -121,18 +115,21 @@
bottom: 10px;
left: 0;
z-index: 15;
display: flex;
justify-content: center;
padding-left: 0; // override <ul> default
// Use the .carousel-control's width as margin so we don't overlay those
margin-right: $carousel-control-width;
margin-left: $carousel-control-width;
text-align: center;
list-style: none;

li {
position: relative;
display: inline-block;
width: $carousel-indicator-width;
flex: 1 0 auto;
max-width: $carousel-indicator-width;
height: $carousel-indicator-height;
margin-right: $carousel-indicator-spacer;
margin-left: $carousel-indicator-spacer;
text-indent: -999px;
cursor: pointer;
background-color: rgba($carousel-indicator-active-bg, .5);
Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ $carousel-control-opacity: .5 !default;

$carousel-indicator-width: 30px !default;
$carousel-indicator-height: 3px !default;
$carousel-indicator-spacer: 3px !default;
$carousel-indicator-active-bg: #fff !default;

$carousel-caption-width: 70% !default;
Expand Down