add styles to range inputs

This commit is contained in:
t1m0n 2016-01-27 13:59:33 +03:00
parent 97d0402721
commit 5bbb57cfd0
6 changed files with 193 additions and 29 deletions

View File

@ -392,17 +392,30 @@
Timepicker Timepicker
------------------------------------------------- */ ------------------------------------------------- */
.datepicker--time { .datepicker--time {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
padding: 4px; padding: 4px;
position: relative; } position: relative; }
.datepicker--time-sliders {
-webkit-flex: 0 1 138px;
-ms-flex: 0 1 138px;
flex: 0 1 138px; }
.datepicker--time-label { .datepicker--time-label {
display: block; display: none;
font-size: 12px; } font-size: 12px; }
.datepicker--time-current { .datepicker--time-current {
font-size: 12px; font-size: 16px;
position: absolute; -webkit-flex: 1;
right: 4px; } -ms-flex: 1;
flex: 1;
text-align: center; }
.datepicker--time-row { .datepicker--time-row {
display: -webkit-flex; display: -webkit-flex;
@ -411,11 +424,63 @@
-webkit-align-items: center; -webkit-align-items: center;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
font-size: 11px; } font-size: 11px;
height: 24px;
background: linear-gradient(to right, #dedede, #dedede) left 50%/100% 2px no-repeat; }
.datepicker--time-row input[type='range'] { .datepicker--time-row input[type='range'] {
background: none;
-webkit-flex: 1; -webkit-flex: 1;
-ms-flex: 1; -ms-flex: 1;
flex: 1; } flex: 1;
height: 100%;
padding: 0;
margin: 0;
-webkit-appearance: none; }
.datepicker--time-row input[type='range']::-webkit-slider-thumb {
-webkit-appearance: none; }
.datepicker--time-row input[type='range']::-ms-tooltip {
display: none; }
.datepicker--time-row input[type='range']:focus {
outline: none; }
.datepicker--time-row input[type='range']::-webkit-slider-thumb {
height: 10px;
width: 10px;
border-radius: 50%;
background: #5cc4ef;
margin-top: -5px;
cursor: pointer; }
.datepicker--time-row input[type='range']::-moz-range-thumb {
height: 10px;
width: 10px;
border-radius: 50%;
border: none;
background: #5cc4ef;
cursor: pointer; }
.datepicker--time-row input[type='range']::-ms-thumb {
height: 10px;
width: 10px;
border: none;
border-radius: 50%;
background: #5cc4ef;
cursor: pointer; }
.datepicker--time-row input[type='range']::-webkit-slider-runnable-track {
height: 2px;
cursor: pointer;
background: transparent; }
.datepicker--time-row input[type='range']::-moz-range-track {
height: 2px;
cursor: pointer;
background: transparent; }
.datepicker--time-row input[type='range']::-ms-track {
border: none;
height: 10px;
cursor: pointer;
color: transparent;
background: transparent; }
.datepicker--time-row input[type='range']::-ms-fill-lower {
background: transparent; }
.datepicker--time-row input[type='range']::-ms-fill-upper {
background: transparent; }
.datepicker--time-row span { .datepicker--time-row span {
padding: 0 12px; } padding: 0 12px; }

File diff suppressed because one or more lines are too long

View File

@ -1717,7 +1717,7 @@ var Datepicker;
(function (window, $, datepicker) { (function (window, $, datepicker) {
var template = '<div class="datepicker--time">' + var template = '<div class="datepicker--time">' +
'<div class="datepicker--time-current">#{hourValue}:#{minValue}</div>' + '<div class="datepicker--time-sliders">' +
' <label class="datepicker--time-label">#{hourLabel}</label>' + ' <label class="datepicker--time-label">#{hourLabel}</label>' +
' <div class="datepicker--time-row">' + ' <div class="datepicker--time-row">' +
' <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' + ' <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' +
@ -1726,6 +1726,8 @@ var Datepicker;
' <div class="datepicker--time-row">' + ' <div class="datepicker--time-row">' +
' <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' + ' <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' +
' </div>' + ' </div>' +
'</div>' +
'<div class="datepicker--time-current">#{hourValue}:#{minValue}</div>' +
'</div>'; '</div>';
datepicker.Timepicker = function (inst, opts) { datepicker.Timepicker = function (inst, opts) {
this.d = inst; this.d = inst;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
(function (window, $, datepicker) { (function (window, $, datepicker) {
var template = '<div class="datepicker--time">' + var template = '<div class="datepicker--time">' +
'<div class="datepicker--time-current">#{hourValue}:#{minValue}</div>' + '<div class="datepicker--time-sliders">' +
' <label class="datepicker--time-label">#{hourLabel}</label>' + ' <label class="datepicker--time-label">#{hourLabel}</label>' +
' <div class="datepicker--time-row">' + ' <div class="datepicker--time-row">' +
' <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' + ' <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' +
@ -9,6 +9,8 @@
' <div class="datepicker--time-row">' + ' <div class="datepicker--time-row">' +
' <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' + ' <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' +
' </div>' + ' </div>' +
'</div>' +
'<div class="datepicker--time-current">#{hourValue}:#{minValue}</div>' +
'</div>'; '</div>';
datepicker.Timepicker = function (inst, opts) { datepicker.Timepicker = function (inst, opts) {
this.d = inst; this.d = inst;

View File

@ -4,31 +4,126 @@
Timepicker Timepicker
------------------------------------------------- */ ------------------------------------------------- */
$rangeTrackHeight: 2px;
$rangeTrackBg: #dedede;
$rangeThumbSize: 10px;
$rangeThumbBg: #5cc4ef;
.datepicker--time { .datepicker--time {
display: flex;
align-items: center;
padding: $datepickerPadding; padding: $datepickerPadding;
position: relative; position: relative;
} }
.datepicker--time-sliders {
flex: 0 1 138px;
}
.datepicker--time-label { .datepicker--time-label {
display: block; display: none;
font-size: 12px; font-size: 12px;
} }
.datepicker--time-current { .datepicker--time-current {
font-size: 12px; font-size: 16px;
position: absolute; flex: 1;
right: $datepickerPadding; text-align: center;
} }
.datepicker--time-row { .datepicker--time-row {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 11px; font-size: 11px;
height: 24px;
background: linear-gradient(to right,#dedede,#dedede) left 50%/100% 2px no-repeat;
input[type='range'] { input[type='range'] {
background: none;
flex: 1; flex: 1;
height: 100%;
padding: 0;
margin: 0;
-webkit-appearance: none;
&::-webkit-slider-thumb {
-webkit-appearance: none;
} }
&::-ms-tooltip {
display: none;
}
&:focus {
outline: none;
}
// Thumb
// -------------------------------------------------
&::-webkit-slider-thumb {
height: $rangeThumbSize;
width: $rangeThumbSize;
border-radius: 50%;
background: $rangeThumbBg;
margin-top: -$rangeThumbSize/2;
cursor: pointer;
}
&::-moz-range-thumb {
height: $rangeThumbSize;
width: $rangeThumbSize;
border-radius: 50%;
border: none;
background: $rangeThumbBg;
cursor: pointer;
}
&::-ms-thumb {
height: $rangeThumbSize;
width: $rangeThumbSize;
border: none;
border-radius: 50%;
background: $rangeThumbBg;
cursor: pointer;
}
// Track
// -------------------------------------------------
&::-webkit-slider-runnable-track {
height: $rangeTrackHeight;
cursor: pointer;
background: transparent;
}
&::-moz-range-track {
height: $rangeTrackHeight;
cursor: pointer;
background: transparent;
}
&::-ms-track {
border: none;
height: $rangeThumbSize;
cursor: pointer;
color: transparent;
background: transparent;
}
&::-ms-fill-lower {
background: transparent;
}
&:focus::-ms-fill-lower {
}
&::-ms-fill-upper {
background: transparent;
}
&:focus::-ms-fill-upper {
}
}
span { span {
padding: 0 12px; padding: 0 12px;
} }