Debian Codegraph @

demos/autocomplete/maxheight.html

raw
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery UI Autocomplete - Scrollable results</title>
7 <link rel="stylesheet" href="../../themes/base/all.css">
8 <link rel="stylesheet" href="../demos.css">
9 <style>
10 .ui-autocomplete {
11 max-height: 100px;
12 overflow-y: auto;
13 /* prevent horizontal scrollbar */
14 overflow-x: hidden;
15 }
16 /* IE 6 doesn't support max-height
17 * we use height instead, but this forces the menu to always be this tall
18 */
19 * html .ui-autocomplete {
20 height: 100px;
21 }
22 </style>
23 <script src="../../external/requirejs/require.js"></script>
24 <script src="../bootstrap.js">
25 var availableTags = [
26 "ActionScript",
27 "AppleScript",
28 "Asp",
29 "BASIC",
30 "C",
31 "C++",
32 "Clojure",
33 "COBOL",
34 "ColdFusion",
35 "Erlang",
36 "Fortran",
37 "Groovy",
38 "Haskell",
39 "Java",
40 "JavaScript",
41 "Lisp",
42 "Perl",
43 "PHP",
44 "Python",
45 "Ruby",
46 "Scala",
47 "Scheme"
48 ];
49 $( "#tags" ).autocomplete({
50 source: availableTags
51 });
52 </script>
53 </head>
54 <body>
55
56 <div class="ui-widget">
57 <label for="tags">Tags: </label>
58 <input id="tags">
59 </div>
60
61 <div class="demo-description">
62 <p>When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.</p>
63 </div>
64 </body>
65 </html>