jquery-ui-slider

Jquery ui slider with string values?

怎甘沉沦 提交于 2019-12-01 00:21:29
问题 I am working with jQuery UI slider. Here is the code i am using: $(function() { $( "#slider" ).slider({ value:1, min: 0, max: 5, step: 1, slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.value ); } }); $( "#amount" ).val( "$" + $( "#slider" ).slider( "value" ) ); }); There will be 5 steps and I'd like to show the strings in each step instead of the numbers: 1=very sad 2=sad 3=not so sad 4=happy 5=very happy How can I do this ? 回答1: You can put your step labels in an array, then use

jQuery UI Sliders - Select overlapping sliders based on dragging direction

非 Y 不嫁゛ 提交于 2019-11-30 15:23:39
问题 I have this simple jQuery UI Slider setup with a range and a two default values that overlap. The entire thing (with a few bells and whistles) can be found in this jsfiddle: http://jsfiddle.net/yijiang/XeyGS/ $('#slider').slider({ min: 1, max: 11, range: true, values: [4, 4] }); The problem with this is that when you attempt the drag the single visible handle to the right, it fails, because jQuery UI always places the minimum handle on top. This is obviously bad, for a number of reasons. Is

jQuery UI Sliders - Select overlapping sliders based on dragging direction

淺唱寂寞╮ 提交于 2019-11-30 13:29:36
I have this simple jQuery UI Slider setup with a range and a two default values that overlap. The entire thing (with a few bells and whistles) can be found in this jsfiddle: http://jsfiddle.net/yijiang/XeyGS/ $('#slider').slider({ min: 1, max: 11, range: true, values: [4, 4] }); The problem with this is that when you attempt the drag the single visible handle to the right, it fails, because jQuery UI always places the minimum handle on top. This is obviously bad, for a number of reasons. Is there a way to allow jQuery UI to choose which handle to drag depending on which direction the user

Slider with Multiple Handle and Background Color for content

泪湿孤枕 提交于 2019-11-30 10:22:26
I am trying to work with Jquery UI slider where I can have multiple handles: $(function () { var handlers = [25, 50, 75]; $("#slider").slider({ min: 0, max: 100, values: handlers, slide: function (evt, ui) { for (var i = 0, l = ui.values.length; i < l; i++) { if (i !== l - 1 && ui.values[i] > ui.values[i + 1]) { return false; } else if (i === 0 && ui.values[i] < ui.values[i - 1]) { return false; } } } }); }); Please note that one handler can't overlap and I will need to set the handler dynamically on load, and save the handler positions on change. The thing that i am trying to accomplish is to

jQuery UI Slider: move the value along (with) the handle

…衆ロ難τιáo~ 提交于 2019-11-30 00:23:39
I used the jQuery UI slider component in my page to set a range of prices. I can also use their ui.values[] to set and show the new values in other divs. How can I make to see the new value under the handle . I.e. if I moved the handle to $100, I want to set the "$100" text right under that handle. BTW, I use the range version - to set a range of prices, so I got TWO handles on my slider (min & max). var minPriceRange=100; var maxPriceRange=500; $( "#priceRangeSlider" ).slider({ range: true, min: minPriceRange, max: maxPriceRange, step: 10, values: [ minPriceRange, maxPriceRange ], slide:

jQuery slider “change” event: How do I determine who called it?

浪子不回头ぞ 提交于 2019-11-29 13:50:39
I got a slider that is used as a time-line in my music player. The min value is 0 and the max vlaue is the song length (in seconds). Each second (I do this with a timer), the slider moves and the value is set to the current time. This code line looks like that: $("#sliderTime").slider("option", "value", document.sound.controls.currentPosition); The user is able to slide/click the slider and jump to another point in the song, this is by firing the function 'play(startPlayFromHere)'. It looks like that: $("#sliderTime").slider({ ... change: function (event, ui) { play(ui.value) }, }); The

jQuery UI Slider - Value returned from 'slide' event on release is different from 'change' value

时光毁灭记忆、已成空白 提交于 2019-11-29 09:57:52
I have a jQuery UI slider: $('div.slider').slider({ range: true, step: 250, min: 1000, max: 500000, values: [1000,500000], change: function(event, ui){ console.log($(this).slider('values', 0)+','+$(this).slider('values', 1)); }, slide: function(event, ui){ console.log($(this).slider('values', 0)+','+$(this).slider('values', 1)); } }); For some odd reason, when releasing the slider (mouseup) the value changes slightly from what it was. The slide event is returning something different than what the change event is. Anyone have any ideas what might be causing this and how I could solve it? I'm

Jquery UI slider with two handles with input from two text box?

两盒软妹~` 提交于 2019-11-29 04:26:37
I need a jquery slider with two handles with inputs from two textbox like this http://www.israel-diamonds.com/search/diamonds/default.aspx .Currently i have a single handle slider with input from a single textbox $("#slider").slider({ value: 1, step: 1000, min: 0, max: 5000000, slide: function(event, ui) { $("input").val("$" + ui.value); } }); $("input").change(function () { var value = this.value.substring(1); console.log(value); $("#slider").slider("value", parseInt(value)); }); Any suggestion? EDIT: <div class="demo"> <input type="text" class="sliderValue" /> <p> </p> <div id="slider"></div

jQuery UI Slider: move the value along (with) the handle

老子叫甜甜 提交于 2019-11-28 21:26:15
问题 I used the jQuery UI slider component in my page to set a range of prices. I can also use their ui.values[] to set and show the new values in other divs. How can I make to see the new value under the handle . I.e. if I moved the handle to $100, I want to set the "$100" text right under that handle. BTW, I use the range version - to set a range of prices, so I got TWO handles on my slider (min & max). var minPriceRange=100; var maxPriceRange=500; $( "#priceRangeSlider" ).slider({ range: true,

jQuery UI Slider - max value (not end of slider)

混江龙づ霸主 提交于 2019-11-28 13:10:35
I have a stepped slider, with non-linear steps - code: $(function() { var trueValues = [5, 10, 20, 50, 100, 150]; var values = [10, 20, 30, 40, 60, 100]; var slider = $("#parkSlider").slider({ orientation: 'horizontal', range: "min", value: 40, slide: function(event, ui) { var includeLeft = event.keyCode != $.ui.keyCode.RIGHT; var includeRight = event.keyCode != $.ui.keyCode.LEFT; var value = findNearest(includeLeft, includeRight, ui.value); slider.slider('value', value); $("#amount").val(getRealValue(value)); return false; }, }); function findNearest(includeLeft, includeRight, value) { var