rangemax.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Slider - Range with fixed maximum</title>
  6. <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
  7. <script src="../../jquery-1.10.2.js"></script>
  8. <script src="../../ui/jquery.ui.core.js"></script>
  9. <script src="../../ui/jquery.ui.widget.js"></script>
  10. <script src="../../ui/jquery.ui.mouse.js"></script>
  11. <script src="../../ui/jquery.ui.slider.js"></script>
  12. <link rel="stylesheet" href="../demos.css">
  13. <script>
  14. $(function() {
  15. $( "#slider-range-max" ).slider({
  16. range: "max",
  17. min: 1,
  18. max: 10,
  19. value: 2,
  20. slide: function( event, ui ) {
  21. $( "#amount" ).val( ui.value );
  22. }
  23. });
  24. $( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
  25. });
  26. </script>
  27. </head>
  28. <body>
  29. <p>
  30. <label for="amount">Minimum number of bedrooms:</label>
  31. <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
  32. </p>
  33. <div id="slider-range-max"></div>
  34. <div class="demo-description">
  35. <p>Fix the maximum value of the range slider so that the user can only select a minimum. Set the <code>range</code> option to "max."</p>
  36. </div>
  37. </body>
  38. </html>