Select able
优质
小牛编辑
136浏览
2023-12-01
描述 (Description)
Select able函数可以与JqueryUI中的交互一起使用。可以在任何DOM元素上启用此功能选择功能。使用光标绘制一个框以选择项目。 按住Ctrl键可以进行多个不相邻的选择。
语法 (Syntax)
以下是使用可拖动的简单语法 -
$( "#selectable" ).selectable();
例子 (Example)
以下是一个简单的示例,显示了select的用法 -
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<title>jQuery UI Selectable - Default functionality</title>
<link rel = "stylesheet"
href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script type = "text/javascript"
src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script type = "text/javascript"
src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
</script>
<style>
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
$(function() {
$( "#selectable" ).selectable();
});
</script>
</head>
<body>
<ol id = "selectable">
<li class = "ui-widget-content">Item 1</li>
<li class = "ui-widget-content">Item 2</li>
<li class = "ui-widget-content">Item 3</li>
<li class = "ui-widget-content">Item 4</li>
<li class = "ui-widget-content">Item 5</li>
<li class = "ui-widget-content">Item 6</li>
<li class = "ui-widget-content">Item 7</li>
</ol>
</body>
</html>