number-input.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*=========================================================================================
  2. File Name: input-groups.js
  3. Description: Input Groups js
  4. ----------------------------------------------------------------------------------------
  5. Item name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
  6. Author: PIXINVENT
  7. Author URL: http://www.themeforest.net/user/pixinvent
  8. ==========================================================================================*/
  9. (function (window, document, $) {
  10. 'use strict';
  11. var $html = $('html');
  12. // Default Spin
  13. $(".touchspin").TouchSpin({
  14. buttondown_class: "btn btn-primary",
  15. buttonup_class: "btn btn-primary",
  16. });
  17. // Icon Change
  18. $(".touchspin-icon").TouchSpin({
  19. buttondown_txt: '<i class="feather icon-chevron-down"></i>',
  20. buttonup_txt: '<i class="feather icon-chevron-up"></i>'
  21. });
  22. // Min - Max
  23. var touchspinValue = $(".touchspin-min-max"),
  24. counterMin = 15,
  25. counterMax = 21;
  26. if (touchspinValue.length > 0) {
  27. touchspinValue.TouchSpin({
  28. min: counterMin,
  29. max: counterMax
  30. }).on('touchspin.on.startdownspin', function () {
  31. var $this = $(this);
  32. $('.bootstrap-touchspin-up').removeClass("disabled-max-min");
  33. if ($this.val() == counterMin) {
  34. $(this).siblings().find('.bootstrap-touchspin-down').addClass("disabled-max-min");
  35. }
  36. }).on('touchspin.on.startupspin', function () {
  37. var $this = $(this);
  38. $('.bootstrap-touchspin-down').removeClass("disabled-max-min");
  39. if ($this.val() == counterMax) {
  40. $(this).siblings().find('.bootstrap-touchspin-up').addClass("disabled-max-min");
  41. }
  42. });
  43. }
  44. // Step
  45. $(".touchspin-step").TouchSpin({
  46. step: 5
  47. });
  48. // Color Options
  49. $(".touchspin-color").each(function (index) {
  50. var down = "btn btn-primary",
  51. up = "btn btn-primary",
  52. $this = $(this);
  53. if ($this.data('bts-button-down-class')) {
  54. down = $this.data('bts-button-down-class');
  55. }
  56. if ($this.data('bts-button-up-class')) {
  57. up = $this.data('bts-button-up-class');
  58. }
  59. $this.TouchSpin({
  60. mousewheel: false,
  61. buttondown_class: down,
  62. buttonup_class: up,
  63. buttondown_txt: '<i class="feather icon-minus"></i>',
  64. buttonup_txt: '<i class="feather icon-plus"></i>'
  65. });
  66. });
  67. })(window, document, jQuery);