ionrangeslider-demo.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* Ion RangeSlider */
  2. $(function() {
  3. "use strict";
  4. $("#ion-slider-basic").ionRangeSlider({
  5. min: 0,
  6. max: 5000,
  7. type: 'double',
  8. prefix: "$",
  9. maxPostfix: "+",
  10. prettify: false,
  11. hasGrid: true,
  12. gridMargin: 7
  13. });
  14. });
  15. $(function() {
  16. "use strict";
  17. $("#ion-slider-money").ionRangeSlider({
  18. min: 1000,
  19. max: 100000,
  20. from: 30000,
  21. to: 90000,
  22. type: 'double',
  23. step: 500,
  24. postfix: " €",
  25. hasGrid: true,
  26. gridMargin: 15
  27. });
  28. });
  29. $(function() {
  30. "use strict";
  31. $("#ion-slider-carat").ionRangeSlider({
  32. min: 0,
  33. max: 10,
  34. type: 'single',
  35. step: 0.1,
  36. postfix: " carats",
  37. prettify: false,
  38. hasGrid: true
  39. });
  40. });
  41. $(function() {
  42. "use strict";
  43. $("#ion-slider-date").ionRangeSlider({
  44. values: [
  45. "January", "February",
  46. "March", "April",
  47. "May", "June",
  48. "July", "August",
  49. "September", "October",
  50. "November", "December"
  51. ],
  52. type: 'single',
  53. hasGrid: true
  54. });
  55. });
  56. $(function() {
  57. "use strict";
  58. $("#ion-slider-console").ionRangeSlider({
  59. min: 1000000,
  60. max: 100000000,
  61. type: "double",
  62. postfix: " pounds",
  63. step: 10000,
  64. from: 25000000,
  65. to: 35000000,
  66. onChange: function(obj) {
  67. delete obj.input;
  68. delete obj.slider;
  69. var t = "Range Slider value: " + JSON.stringify(obj, "", 2);
  70. $("#result").html(t);
  71. },
  72. onLoad: function(obj) {
  73. delete obj.input;
  74. delete obj.slider;
  75. var t = "Range Slider value: " + JSON.stringify(obj, "", 2);
  76. $("#result").html(t);
  77. }
  78. });
  79. $("#updateLast").on("click", function() {
  80. $("#example_8").ionRangeSlider("update", {
  81. min: Math.round(10000 + Math.random() * 40000),
  82. max: Math.round(200000 + Math.random() * 100000),
  83. step: 1,
  84. from: Math.round(40000 + Math.random() * 40000),
  85. to: Math.round(150000 + Math.random() * 80000)
  86. });
  87. });
  88. });