leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.67k stars 659 forks source link

Add classes to handles #79

Closed AlecRust closed 11 years ago

AlecRust commented 11 years ago

If you have a slider with two handles, there's no way to target them individually - they're both just a <div>.

Could you add .slider-from and .slider-to (or similar) classes to these handles to allow this?

leongersen commented 11 years ago
a:first-child div {
    /* style for first handle */
}
a + a div {
    /* style for second handle */
}

See for support: caniuse.com

henryruhs commented 11 years ago

answers like that won't make your plugin better, add more classes for better styling

leongersen commented 11 years ago

Not that I won't, but whats wrong with that answer?

henryruhs commented 11 years ago

it does not solve the issue and tag styling is a bad practice in this case.

please add classes to all elements, this btw. was a reason i switched back to jquery ui.

leongersen commented 11 years ago

I'll add some classes, but I'll say this: tag styling is a bad practice is just plain not true.

henryruhs commented 11 years ago

maby not true with your experience in css :D

AlecRust commented 11 years ago

Have to agree with @redaxmedia, it's far better to use prefixed classes for things like this. I'd add them to all appropriate elements.

Benefits include having better control over your stylesheet's specificity, more modular, more robust (allows elements to change in future versions without breaking things) and lends itself better to class-based stylesheets which seem to be the trend right now (for good reason imo).

henryruhs commented 11 years ago

thanks for pointing it out!

anyhow, you have a great plugin - keep improving it, there is a future for responsive (non jquery) web projects...

leongersen commented 11 years ago

Good discussion, so far. Do you have a source or supporting article for class-based stylesheets [...] seem to be the trend right now?

leongersen commented 11 years ago

Anyway, I've added some classes to the codebase, and I'll will push the code soon.

AlecRust commented 11 years ago

Here's a good article on it: http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/

Many thanks for the addition!

AlecRust commented 11 years ago

@leongersen Have you added these classes?

aaly00 commented 5 years ago

@leongersen Have this issue been addressed?

leongersen commented 5 years ago

@afroty, it was, somewhere in 2013.

aaly00 commented 5 years ago

@leongersen Sorry for commenting on a very old issue. I noticed noUi-handle- (upper and lower) to max and min handles, but if you have more than two the ones in the middle seems to not have a specific class. Is there something I am missing as to how to style them individually.

leongersen commented 5 years ago

All handles have a [data-handle] attribute, so you can do something like .noUi-handle[data-handle="4"].

aaly00 commented 5 years ago

Thanks

markgulisao commented 5 years ago

HI is there anyway i could change the icon for the handle into a fa fa-calendar-plus-o icon for example? or can i add fa fa-calendar-plus-o icon somewhere within the slider itself? appreciate the help.

leongersen commented 5 years ago

@markgulisao Something like document.querySelector('.noUi-handle[data-handle="4"]').classList += 'fa fa-calendar-plus-o'; should do.

markgulisao commented 5 years ago

is that for changing the handle icon or for adding an icon within the slider. im sorry im not that proficient with coding yet. i plan to put the icons as stop point for the handle and an event happens once the handle reach the icon.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.