What i am trying to achieve is this:
And when the slider is at any given point other than 100%:
The requirements are:
I have so far tried doing this using background image property, but facing the above constraints when it comes to responsiveness.
HTML:
<div id="slider-range-min"></div>
CSS:
body {
padding:5vh;
}
#amount {
border: 0;
color: #f6931f;
font-weight: bold;
}
.ui-slider-horizontal {
height: 8vh;
}
.ui-widget-header {
border: 1px solid #aaaaaa;
background: #cccccc url(http://s13.postimg.org/e9jwzqsqv/gradient.png) no-repeat left top !important;
color: #222222;
font-weight: bold;
height: 15px;
width: 20vh;
position: absolute;
}
.ui-widget-content {
border: 1px solid #aaaaaa;
background: #f1f1f1 url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
color: #222222;
}
.ui-slider-horizontal .ui-slider-handle {
top: 0.6vh;
}
JS:
$(function () {
$("#slider-range-min").slider({
range: "min",
value: 37,
min: 30,
max: 50,
slide: function (event, ui) {
$("#amount").val("$" + ui.value);
}
});
$("#amount").val("$" + $("#slider-range-min").slider("value"));
});
look at end of css and customize your way:
.ui-slider-handle { height:101%!important; margin-top:-0.75%}
About the background:
Use :
$( window ).resize(function() {
/*Here, you have to update the gradient width*/
$("#my_slider.ui-widget-header").width(/* here*/);
/*or other properties*/
$("#my_slider.ui-widget-header").css("...prop...","...value...");
});
Brief, CSS is not suffisant to make it 100% responsive. You have to use some JQuery.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.