1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <title>jQuery UI Slider - Range with fixed minimum</title>
|
---|
5 | <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
|
---|
6 | <script type="text/javascript" src="../../jquery-1.4.1.js"></script>
|
---|
7 | <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
---|
8 | <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
---|
9 | <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
---|
10 | <script type="text/javascript" src="../../ui/jquery.ui.slider.js"></script>
|
---|
11 | <link type="text/css" href="../demos.css" rel="stylesheet" />
|
---|
12 | <style type="text/css">
|
---|
13 | #demo-frame > div.demo { padding: 10px !important; };
|
---|
14 | </style>
|
---|
15 | <script type="text/javascript">
|
---|
16 | $(function() {
|
---|
17 | var select = $("#minbeds");
|
---|
18 | var slider = $('<div id="slider"></div>').insertAfter(select).slider({
|
---|
19 | min: 1,
|
---|
20 | max: 6,
|
---|
21 | range: "min",
|
---|
22 | value: select[0].selectedIndex + 1,
|
---|
23 | slide: function(event, ui) {
|
---|
24 | select[0].selectedIndex = ui.value - 1;
|
---|
25 | }
|
---|
26 | });
|
---|
27 | $("#minbeds").click(function() {
|
---|
28 | slider.slider("value", this.selectedIndex + 1);
|
---|
29 | });
|
---|
30 | });
|
---|
31 | </script>
|
---|
32 | </head>
|
---|
33 | <body>
|
---|
34 |
|
---|
35 | <div class="demo">
|
---|
36 |
|
---|
37 | <form id="reservation">
|
---|
38 | <label for="minbeds">Minimum number of beds</label>
|
---|
39 | <select name="minbeds" id="minbeds">
|
---|
40 | <option>1</option>
|
---|
41 | <option>2</option>
|
---|
42 | <option>3</option>
|
---|
43 | <option>4</option>
|
---|
44 | <option>5</option>
|
---|
45 | <option>6</option>
|
---|
46 | </select>
|
---|
47 | </form>
|
---|
48 |
|
---|
49 | </div><!-- End demo -->
|
---|
50 |
|
---|
51 | <div class="demo-description">
|
---|
52 |
|
---|
53 | <p>How to bind a slider to an existing select element. The select stays visible to display the change. When the select is changed, the slider is updated, too.</p>
|
---|
54 |
|
---|
55 | </div><!-- End demo-description -->
|
---|
56 |
|
---|
57 | </body>
|
---|
58 | </html>
|
---|