سؤال

Any ideas on how to style a range slider to do something like this where the highlight fill increases along an incline as you drag the slider (colors/design are example only):

enter image description here

هل كانت مفيدة؟

المحلول

Just made this for you: FIDDLE

HTML

<div class="content"></div>
<div id="slider"></div>

CSS

.content {
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 0 0 0 0;
    margin-top:100px;
    border-color: transparent transparent #007bff transparent;
}
#slider {
    width: 500px;
}

JS

$('#slider').slider({
    min: 0,
    max: 100,
    slide: function( event, ui ) {
        var width = (ui.value) + 'px ' + (ui.value * 5) + 'px';
        var marginTop = (100 - ui.value) + 'px';
        $('.content').css({
            borderWidth: '0 0 ' + width,
            marginTop: marginTop
        });
    }
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top