jQuery UI Spinner停止事件
jQuery UI由GUI部件,视觉效果和主题组成,使用jQuery,CSS和HTML来实现。jQuery UI对于构建网页的UI界面非常有用。在这篇文章中,我们将看到如何在jQuery UI滑块中使用停止事件。停止事件是在jQuery UI spinner中旋转后被触发的。
语法:
$( ".selector" ).spinner({
stop: function( event, ui ) {}
});
CDN链接:首先,添加jQuery UI脚本的CDN链接,为你的任务所需。
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
下面的例子说明了jQuery UI Spinner的停止事件。
示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link href=
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel="stylesheet" />
<script src=
"https://code.jquery.com/jquery-1.10.2.js">
</script>
<script src=
"https://code.jquery.com/ui/1.10.4/jquery-ui.js">
</script>
<style type="text/css">
#gfg input {
width: 100px;
}
</style>
<script>
(function () {
("#gfg").spinner({
stop: function (event, ui) {
console.log("stopped");
},
});
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner stop event</h2>
<input id="gfg" />
</body>
</html>
输出: