1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <title>jQuery UI Selectable - Serialize</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.selectable.js"></script>
|
---|
11 | <link type="text/css" href="../demos.css" rel="stylesheet" />
|
---|
12 |
|
---|
13 | <style type="text/css">
|
---|
14 | #feedback { font-size: 1.4em; }
|
---|
15 | #selectable .ui-selecting { background: #FECA40; }
|
---|
16 | #selectable .ui-selected { background: #F39814; color: white; }
|
---|
17 | #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
|
---|
18 | #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
|
---|
19 | </style>
|
---|
20 | <script type="text/javascript">
|
---|
21 | $(function() {
|
---|
22 | $("#selectable").selectable({
|
---|
23 | stop: function(){
|
---|
24 | var result = $("#select-result").empty();
|
---|
25 | $(".ui-selected", this).each(function(){
|
---|
26 | var index = $("#selectable li").index(this);
|
---|
27 | result.append(" #" + (index + 1));
|
---|
28 | });
|
---|
29 | }
|
---|
30 | });
|
---|
31 | });
|
---|
32 | </script>
|
---|
33 | </head>
|
---|
34 | <body>
|
---|
35 | <div class="demo">
|
---|
36 |
|
---|
37 | <p id="feedback">
|
---|
38 | You've selected: <span id="select-result">none</span>.
|
---|
39 | </p>
|
---|
40 |
|
---|
41 | <ol id="selectable">
|
---|
42 | <li class="ui-widget-content">Item 1</li>
|
---|
43 | <li class="ui-widget-content">Item 2</li>
|
---|
44 | <li class="ui-widget-content">Item 3</li>
|
---|
45 | <li class="ui-widget-content">Item 4</li>
|
---|
46 | <li class="ui-widget-content">Item 5</li>
|
---|
47 | <li class="ui-widget-content">Item 6</li>
|
---|
48 | </ol>
|
---|
49 |
|
---|
50 | </div><!-- End demo -->
|
---|
51 |
|
---|
52 | <div class="demo-description">
|
---|
53 |
|
---|
54 | <p>Write a function that fires on the <code>stop</code> event to collect the index values of selected items. Present values as feedback, or pass as a data string.</p>
|
---|
55 |
|
---|
56 | </div><!-- End demo-description -->
|
---|
57 | </body>
|
---|
58 | </html>
|
---|