javascript-ej1-demos/autocomplete/keyboard.html

104 строки
4.0 KiB
HTML

<!doctype html>
<html>
<head>
<title>Essential JS 1 : Autocomplete Keyboard navigation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
<link href="../content/bootstrap.min.css" rel="stylesheet">
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<link href="../content/default.css" rel="stylesheet" />
<link href="../content/default-responsive.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="../scripts/jquery-1.11.3.min.js" type="text/javascript"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"></script>
<!--<![endif]-->
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
<script src="../scripts/properties.js" type="text/javascript"></script>
</head>
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div class="frame">
<div class="control">
<input type="text" id="keyboard"/>
</div>
</div>
</div>
<div id="sampleProperties">
<div class="prop-grid keyboard">
<div class="row">
<div class="col-md-3">
Alt + j
</div>
<div class="col-md-3">
Focuses the control
</div>
</div>
<div class="row">
<div class="col-md-3">
Up
</div>
<div class="col-md-3">
Moves to previous item
</div>
</div>
<div class="row">
<div class="col-md-3">
Down
</div>
<div class="col-md-3">
Moves to next item
</div>
</div>
<div class="row">
<div class="col-md-3">
Enter
</div>
<div class="col-md-3">
Selects the focused item
</div>
</div>
<div class="row">
<div class="col-md-3">
Esc
</div>
<div class="col-md-3">
Closes the popup
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" class="jsScript">
$(function () {
// declaration
var languages = [
"ActionScript", "AppleScript", "ASP", "BASIC", "BeanShell",
"C", "C++", "C#", "Clojure", "COBOL", "ColdFusion", "DataFlex", "DCL",
"Erlang", "E#", "Fortran", "F#", "Flex", "Google Apps Script", "Groovy",
"Haskell", "Hope", "IBM HAScript",
"Java", "JavaScript", "J#", "Lisp", "MATLAB", "Oak", "Perl", "PHP",
"Python", "Ruby", "Scala", "Scheme", "T-SQL", "WebQL", "ZOPL"
];
$('#keyboard').ejAutocomplete({
dataSource: languages,
width: "100%",
watermarkText: "Choose skills",
multiSelectMode: ej.MultiSelectMode.Delimiter,
});
$(document).on("keydown", function (e) {
if (e.altKey && e.keyCode === 74) { // j- key code.
$("#keyboard").focus();
}
});
$("#sampleProperties").ejPropertiesPanel();
});
</script>
</body>
</html>