user2806026 user2806026 - 6 months ago 23
jQuery Question

Can't get rangeslider.js to work

I am trying to use the rangeslider jQuery plugin:
http://andreruffert.github.io/rangeslider.js/

However, it doesn't seem to work. What am I doing wrong?

<input
type="range"
min="10" // default 0
max="1000" // default 100
step="10" // default 1
value="300" // default min + (max-min)/2
data-orientation="vertical" // default horizontal
>

$( document ).ready(function() {
$('input[type="range"]').rangeslider();
});


Jsfiddle: http://jsfiddle.net/8n2ckkmr/

Answer

I don't see what is wrong exactly, so here is an example how to read the slider:

$(document).ready(function () {
    $('input[type="range"]').rangeslider();    
});

$('input').on('change', function () {    
    console.log($(this).val());
});

http://jsfiddle.net/Lvpq5Lvj/

Update about the styling:

You need to match the HTML for it to work and also the classes that are used to apply the CSS http://jsfiddle.net/Lvpq5Lvj/2/

Comments