seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

Button to click next/prev from ticks #922

Closed miloszmich closed 5 years ago

miloszmich commented 5 years ago

It's possible to make smth like button or action to click next and prev from ticks?

I know that is possible to use 'natural_arrow_keys' but it works only with arrows, I need smth with physical visible buttons (like in pic bellow).

[https://prnt.sc/nuzh38]

seiyria commented 5 years ago

Yes, create the buttons and on click, call setValue on the slider instance. To do this with ticks, I'm not certain, but you may be able to emulate an arrow key press if you need it but don't want to store the value array somewhere else in your code.

miloszmich commented 5 years ago

Emulaiting doesn't work for me. I tried with this: $('.metrazSliderBox .slider-plus').click(function (e) { var xxwer = $(this).closest('.metrazSliderBox').find('.slider .slider-handle.min-slider- handle.round').focus(); var e = $.Event('keydown', { keyCode: 39 }); $(xxwer).trigger(e); });