Slider with long labels #1355
-
Hello, I need to create a slider that has steps with long labels. Having a look at this https://jsfiddle.net/h98vpkfs I mean replacing 5, 10, 15 etc. with something like "First day of something" or "Day of some event" and so on. Is there any way to reach that? Maybe with tooltip, but how? |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
-
This sounds better suited for a range calendar as between 2 dates? |
Beta Was this translation helpful? Give feedback.
-
Yes, but I need to have it as a slider, as used in websites like skyscanner. |
Beta Was this translation helpful? Give feedback.
-
You can use the custom interpreted labels feature https://fomantic-ui.com/modules/slider.html#custom-interpreted-labels var labels = [
"First day of something",
"In the middle of nowhere",
"Lost in space",
"End of the world"
];
$('#interpretedlabel')
.slider({
min: 0,
max: 3,
start: 0,
end: 3,
step: 1,
interpretLabel: function(value) {
return labels[value];
}
})
; |
Beta Was this translation helpful? Give feedback.
-
Thank you for your suggestion, but I'm afraid I can't use this because I have to create a very small slider: Can't I use tooltip in this case? |
Beta Was this translation helpful? Give feedback.
-
Sure 😄 |
Beta Was this translation helpful? Give feedback.
-
Wow, perfect! Thank you so much! |
Beta Was this translation helpful? Give feedback.
-
Shouldn't I add an input tag like this:
As seen here? |
Beta Was this translation helpful? Give feedback.
-
The input tag is only there to show the values in the docs. To fetch the values you use the |
Beta Was this translation helpful? Give feedback.
-
In a range slider how to get from the In addition, since I'm wrapping this in an Angular component, do you think I can add an hidden input element to bind it to a formControl? |
Beta Was this translation helpful? Give feedback.
-
I have edited my last post, sorry for double posting now. |
Beta Was this translation helpful? Give feedback.
-
The onChange: function(range, firstVal, secondVal) {
} |
Beta Was this translation helpful? Give feedback.
-
Great! Thank you, I cannot find it in the documentation. |
Beta Was this translation helpful? Give feedback.
-
Hello again, sorry for keeping post here but I have one more question. |
Beta Was this translation helpful? Give feedback.
-
Sounds like a bug we have to investigate. Please create a new issue for that. Thanks |
Beta Was this translation helpful? Give feedback.
Sure 😄
See http://jsfiddle.net/nos06d5e/