I tried to convert several numeric up and down (numeric spinner) control, but I couldn't. JQuery UI Spinner is not an option since I'm using bootstrap 3, and I couldn't deploy the spinner from fuelx stand alone.
I found 2 or 3 similar but are them for bootstrap 2.
After fighting with CSS, I found some guy here that could it, I make a fiddler with his answer but is stil doesn't work. Images doesn't show.
I think is some related with my version of font awesome on:
<a href="javascript:;" class="spin-down" data-spin="down"><i class="fa fa-sort-down"></i>
but I'm not sure. Any hint will be preciated.
Last version of my fiddler: http://jsfiddle.net/Leandro1981/wt8CD/
Related questions:
Convert Bootstrap 2.3.2 & jQuery-Spinner to work with Bootstrap 3.*
Cross-browser Numeric Spinner / Stepper for Bootstrap
Cross-browser Numeric Spinner / Stepper for Bootstrap
A better solution for the javascript part, since the one given only supports a single spinner per page.
$('.spinner .btn:first-of-type').on('click', function() {
var spinner = $(this).parent().parent().find('input');
spinner.val(parseInt(spinner.val(), 10) + 1);
});
$('.spinner .btn:last-of-type').on('click', function() {
var spinner = $(this).parent().parent().find('input');
spinner.val(parseInt(spinner.val(), 10) - 1);
});
A possible update is to add min, max, scroll and keyboard support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With