_progress.scss 3.45 KB
Newer Older
1
2
3
//
// Progress animations
//
4

Piotrek Okoński's avatar
Piotrek Okoński committed
5
@keyframes progress-bar-stripes {
Mark Otto's avatar
Mark Otto committed
6
7
  from { background-position: $spacer-y 0; }
  to { background-position: 0 0; }
8
9
10
}


11
12
13
//
// Basic progress bar
//
14

Piotrek Okoński's avatar
Piotrek Okoński committed
15
.progress {
16
17
  display: block;
  width: 100%;
Mark Otto's avatar
Mark Otto committed
18
19
  height: $spacer-y; // todo: make a new var for this
  margin-bottom: $spacer-y;
20
21
}
.progress[value] {
22
  // Set overall background
23
  background-color: $progress-bg;
24
25
26
27
  // Remove Firefox and Opera border
  border: 0;
  // Reset the default appearance
  appearance: none;
28
29
30
  // Set overall border radius
  @include border-radius($border-radius);
}
31
32

// Filled-in portion of the bar
33
.progress[value]::-ms-fill {
34
  background-color: $progress-bar-color;
35
36
  // Remove right-hand border of value bar from IE10+/Edge
  border: 0;
37
}
38
39
.progress[value]::-moz-progress-bar {
  background-color: $progress-bar-color;
40
  @include border-left-radius($border-radius);
41
}
42
.progress[value]::-webkit-progress-value {
43
  background-color: $progress-bar-color;
44
  @include border-left-radius($border-radius);
45
}
46
47
// Tweaks for full progress bar
.progress[value="100"]::-moz-progress-bar {
48
  @include border-right-radius($border-radius);
49
}
50
.progress[value="100"]::-webkit-progress-value {
51
  @include border-right-radius($border-radius);
52
53
}

54
55
56
57
// Unfilled portion of the bar
.progress[value]::-webkit-progress-bar {
  background-color: $progress-bg;
  @include border-radius($border-radius);
58
  @include box-shadow($progress-box-shadow);
59
}
60
61
62
63
base::-moz-progress-bar, // Absurd-but-syntactically-valid selector to make these styles Firefox-only
.progress[value] {
  background-color: $progress-bg;
  @include border-radius($border-radius);
64
  @include box-shadow($progress-box-shadow);
65
}
Mark Otto's avatar
Mark Otto committed
66

67
// IE9 hacks to accompany custom markup. We don't need to scope this via media queries, but I feel better doing it anyway.
68
@media screen and (min-width:0\0) {
69
  .progress {
70
    background-color: $progress-bg;
71
    @include border-radius($border-radius);
72
    @include box-shadow($progress-box-shadow);
73
74
75
  }
  .progress-bar {
    display: inline-block;
Mark Otto's avatar
Mark Otto committed
76
    height: $spacer-y;
77
    text-indent: -999rem; // Simulate hiding of value as in native `<progress>`
78
    background-color: $progress-bar-color;
79
    @include border-left-radius($border-radius);
80
81
  }
  .progress[width="100%"] {
82
    @include border-right-radius($border-radius);
83
84
85
86
  }
}


87
//
88
89
90
91
// Striped
//

.progress-striped[value]::-webkit-progress-value {
Mark Otto's avatar
Mark Otto committed
92
  @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
93
  background-size: $spacer-y $spacer-y;
94
95
}
.progress-striped[value]::-moz-progress-bar {
Mark Otto's avatar
Mark Otto committed
96
  @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
97
  background-size: $spacer-y $spacer-y;
98
}
99
100
101
102
.progress-striped[value]::-ms-fill {
  @include gradient-striped();
  background-size: $spacer-y $spacer-y;
}
103
// IE9
104
@media screen and (min-width:0\0) {
105
  .progress-bar-striped {
Mark Otto's avatar
Mark Otto committed
106
    @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
107
    background-size: $spacer-y $spacer-y;
108
  }
109
110
}

111
112
113

//
// Animated
114
//
115
116

.progress-animated[value]::-webkit-progress-value {
117
  animation: progress-bar-stripes 2s linear infinite;
118
}
119
120
121
.progress-animated[value]::-moz-progress-bar {
  animation: progress-bar-stripes 2s linear infinite;
}
122
// IE9
123
@media screen and (min-width:0\0) {
124
125
  .progress-animated .progress-bar-striped {
    animation: progress-bar-stripes 2s linear infinite;
126
127
128
  }
}

129

130
//
Mark Otto's avatar
Mark Otto committed
131
// Variations
132
//
133

134
.progress-success {
Mark Otto's avatar
Mark Otto committed
135
  @include progress-variant($progress-bar-success-bg);
136
}
137
.progress-info {
Mark Otto's avatar
Mark Otto committed
138
  @include progress-variant($progress-bar-info-bg);
Mark Otto's avatar
Mark Otto committed
139
}
140
.progress-warning {
Mark Otto's avatar
Mark Otto committed
141
  @include progress-variant($progress-bar-warning-bg);
142
}
143
.progress-danger {
Mark Otto's avatar
Mark Otto committed
144
  @include progress-variant($progress-bar-danger-bg);
145
}