1 | // Notes on the classes:
|
---|
2 | //
|
---|
3 | // 1. .carousel.pointer-event should ideally be pan-y (to allow for users to scroll vertically)
|
---|
4 | // even when their scroll action started on a carousel, but for compatibility (with Firefox)
|
---|
5 | // we're preventing all actions instead
|
---|
6 | // 2. The .carousel-item-start and .carousel-item-end is used to indicate where
|
---|
7 | // the active slide is heading.
|
---|
8 | // 3. .active.carousel-item is the current slide.
|
---|
9 | // 4. .active.carousel-item-start and .active.carousel-item-end is the current
|
---|
10 | // slide in its in-transition state. Only one of these occurs at a time.
|
---|
11 | // 5. .carousel-item-next.carousel-item-start and .carousel-item-prev.carousel-item-end
|
---|
12 | // is the upcoming slide in transition.
|
---|
13 |
|
---|
14 | .carousel {
|
---|
15 | position: relative;
|
---|
16 | }
|
---|
17 |
|
---|
18 | .carousel.pointer-event {
|
---|
19 | touch-action: pan-y;
|
---|
20 | }
|
---|
21 |
|
---|
22 | .carousel-inner {
|
---|
23 | position: relative;
|
---|
24 | width: 100%;
|
---|
25 | overflow: hidden;
|
---|
26 | @include clearfix();
|
---|
27 | }
|
---|
28 |
|
---|
29 | .carousel-item {
|
---|
30 | position: relative;
|
---|
31 | display: none;
|
---|
32 | float: left;
|
---|
33 | width: 100%;
|
---|
34 | margin-right: -100%;
|
---|
35 | backface-visibility: hidden;
|
---|
36 | @include transition($carousel-transition);
|
---|
37 | }
|
---|
38 |
|
---|
39 | .carousel-item.active,
|
---|
40 | .carousel-item-next,
|
---|
41 | .carousel-item-prev {
|
---|
42 | display: block;
|
---|
43 | }
|
---|
44 |
|
---|
45 | .carousel-item-next:not(.carousel-item-start),
|
---|
46 | .active.carousel-item-end {
|
---|
47 | transform: translateX(100%);
|
---|
48 | }
|
---|
49 |
|
---|
50 | .carousel-item-prev:not(.carousel-item-end),
|
---|
51 | .active.carousel-item-start {
|
---|
52 | transform: translateX(-100%);
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | //
|
---|
57 | // Alternate transitions
|
---|
58 | //
|
---|
59 |
|
---|
60 | .carousel-fade {
|
---|
61 | .carousel-item {
|
---|
62 | opacity: 0;
|
---|
63 | transition-property: opacity;
|
---|
64 | transform: none;
|
---|
65 | }
|
---|
66 |
|
---|
67 | .carousel-item.active,
|
---|
68 | .carousel-item-next.carousel-item-start,
|
---|
69 | .carousel-item-prev.carousel-item-end {
|
---|
70 | z-index: 1;
|
---|
71 | opacity: 1;
|
---|
72 | }
|
---|
73 |
|
---|
74 | .active.carousel-item-start,
|
---|
75 | .active.carousel-item-end {
|
---|
76 | z-index: 0;
|
---|
77 | opacity: 0;
|
---|
78 | @include transition(opacity 0s $carousel-transition-duration);
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | //
|
---|
84 | // Left/right controls for nav
|
---|
85 | //
|
---|
86 |
|
---|
87 | .carousel-control-prev,
|
---|
88 | .carousel-control-next {
|
---|
89 | position: absolute;
|
---|
90 | top: 0;
|
---|
91 | bottom: 0;
|
---|
92 | z-index: 1;
|
---|
93 | // Use flex for alignment (1-3)
|
---|
94 | display: flex; // 1. allow flex styles
|
---|
95 | align-items: center; // 2. vertically center contents
|
---|
96 | justify-content: center; // 3. horizontally center contents
|
---|
97 | width: $carousel-control-width;
|
---|
98 | padding: 0;
|
---|
99 | color: $carousel-control-color;
|
---|
100 | text-align: center;
|
---|
101 | background: none;
|
---|
102 | border: 0;
|
---|
103 | opacity: $carousel-control-opacity;
|
---|
104 | @include transition($carousel-control-transition);
|
---|
105 |
|
---|
106 | // Hover/focus state
|
---|
107 | &:hover,
|
---|
108 | &:focus {
|
---|
109 | color: $carousel-control-color;
|
---|
110 | text-decoration: none;
|
---|
111 | outline: 0;
|
---|
112 | opacity: $carousel-control-hover-opacity;
|
---|
113 | }
|
---|
114 | }
|
---|
115 | .carousel-control-prev {
|
---|
116 | left: 0;
|
---|
117 | background-image: if($enable-gradients, linear-gradient(90deg, rgba($black, .25), rgba($black, .001)), null);
|
---|
118 | }
|
---|
119 | .carousel-control-next {
|
---|
120 | right: 0;
|
---|
121 | background-image: if($enable-gradients, linear-gradient(270deg, rgba($black, .25), rgba($black, .001)), null);
|
---|
122 | }
|
---|
123 |
|
---|
124 | // Icons for within
|
---|
125 | .carousel-control-prev-icon,
|
---|
126 | .carousel-control-next-icon {
|
---|
127 | display: inline-block;
|
---|
128 | width: $carousel-control-icon-width;
|
---|
129 | height: $carousel-control-icon-width;
|
---|
130 | background-repeat: no-repeat;
|
---|
131 | background-position: 50%;
|
---|
132 | background-size: 100% 100%;
|
---|
133 | }
|
---|
134 |
|
---|
135 | /* rtl:options: {
|
---|
136 | "autoRename": true,
|
---|
137 | "stringMap":[ {
|
---|
138 | "name" : "prev-next",
|
---|
139 | "search" : "prev",
|
---|
140 | "replace" : "next"
|
---|
141 | } ]
|
---|
142 | } */
|
---|
143 | .carousel-control-prev-icon {
|
---|
144 | background-image: escape-svg($carousel-control-prev-icon-bg);
|
---|
145 | }
|
---|
146 | .carousel-control-next-icon {
|
---|
147 | background-image: escape-svg($carousel-control-next-icon-bg);
|
---|
148 | }
|
---|
149 |
|
---|
150 | // Optional indicator pips/controls
|
---|
151 | //
|
---|
152 | // Add a container (such as a list) with the following class and add an item (ideally a focusable control,
|
---|
153 | // like a button) with data-bs-target for each slide your carousel holds.
|
---|
154 |
|
---|
155 | .carousel-indicators {
|
---|
156 | position: absolute;
|
---|
157 | right: 0;
|
---|
158 | bottom: 0;
|
---|
159 | left: 0;
|
---|
160 | z-index: 2;
|
---|
161 | display: flex;
|
---|
162 | justify-content: center;
|
---|
163 | padding: 0;
|
---|
164 | // Use the .carousel-control's width as margin so we don't overlay those
|
---|
165 | margin-right: $carousel-control-width;
|
---|
166 | margin-bottom: 1rem;
|
---|
167 | margin-left: $carousel-control-width;
|
---|
168 | list-style: none;
|
---|
169 |
|
---|
170 | [data-bs-target] {
|
---|
171 | box-sizing: content-box;
|
---|
172 | flex: 0 1 auto;
|
---|
173 | width: $carousel-indicator-width;
|
---|
174 | height: $carousel-indicator-height;
|
---|
175 | padding: 0;
|
---|
176 | margin-right: $carousel-indicator-spacer;
|
---|
177 | margin-left: $carousel-indicator-spacer;
|
---|
178 | text-indent: -999px;
|
---|
179 | cursor: pointer;
|
---|
180 | background-color: $carousel-indicator-active-bg;
|
---|
181 | background-clip: padding-box;
|
---|
182 | border: 0;
|
---|
183 | // Use transparent borders to increase the hit area by 10px on top and bottom.
|
---|
184 | border-top: $carousel-indicator-hit-area-height solid transparent;
|
---|
185 | border-bottom: $carousel-indicator-hit-area-height solid transparent;
|
---|
186 | opacity: $carousel-indicator-opacity;
|
---|
187 | @include transition($carousel-indicator-transition);
|
---|
188 | }
|
---|
189 |
|
---|
190 | .active {
|
---|
191 | opacity: $carousel-indicator-active-opacity;
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 |
|
---|
196 | // Optional captions
|
---|
197 | //
|
---|
198 | //
|
---|
199 |
|
---|
200 | .carousel-caption {
|
---|
201 | position: absolute;
|
---|
202 | right: (100% - $carousel-caption-width) * .5;
|
---|
203 | bottom: $carousel-caption-spacer;
|
---|
204 | left: (100% - $carousel-caption-width) * .5;
|
---|
205 | padding-top: $carousel-caption-padding-y;
|
---|
206 | padding-bottom: $carousel-caption-padding-y;
|
---|
207 | color: $carousel-caption-color;
|
---|
208 | text-align: center;
|
---|
209 | }
|
---|
210 |
|
---|
211 | // Dark mode carousel
|
---|
212 |
|
---|
213 | .carousel-dark {
|
---|
214 | .carousel-control-prev-icon,
|
---|
215 | .carousel-control-next-icon {
|
---|
216 | filter: $carousel-dark-control-icon-filter;
|
---|
217 | }
|
---|
218 |
|
---|
219 | .carousel-indicators [data-bs-target] {
|
---|
220 | background-color: $carousel-dark-indicator-active-bg;
|
---|
221 | }
|
---|
222 |
|
---|
223 | .carousel-caption {
|
---|
224 | color: $carousel-dark-caption-color;
|
---|
225 | }
|
---|
226 | }
|
---|