jQuery UI Spinner旋转事件
jQuery UI由GUI部件、视觉效果和主题组成,使用jQuery、CSS和HTML实现。jQuery UI对于构建网页的UI界面非常有用。在这篇文章中,我们将看到如何在jQuery UI滑块中使用旋转事件。旋转事件是在jQuery UI旋转器的增量/减量过程中被触发的。
语法:
$( ".selector" ).spinner({
spin: 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({
spin: function (event, ui) {
console.log("spinned");
},
});
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner spin event</h2>
<input id="gfg" />
</body>
</html>
输出: