jQuery UI旋钮图标选项
jQuery UI由GUI部件、视觉效果和使用HTML、CSS和、jQuery实现的主题组成。jQuery UI非常适用于为网页构建UI界面。jQuery UI的旋转图标选项是用来给旋转按钮添加图标的。它的默认值是 { down:"ui-icon-triangle-1-s", up:"ui-icon-triangle-1-n" }
。
语法:
$( ".selector" ).spinner({
icons: {
down: "custom-down-icon",
up: "custom-up-icon"
}
});
CDN链接:首先,添加你的项目需要的jQuery UI脚本。
<link rel=”stylesheet” href=”//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
<script src=”//code.jquery.com/jquery-1.12.4.js”></script>
<script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>
示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href=
"//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js">
</script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js">
</script>
<script>
(function () {
("#gfg").spinner({
icons: {
down: "ui-icon-circle-triangle-s",
up: "ui-icon-circle-triangle-n"
}
});
});
</script>
</head>
<body>
<h1 style="color: green;">GeeksforGeeks</h1>
<h2>jQuery UI spinner icons option</h2>
<div id="geeks">
<input type="text" id="gfg" value="45" />
</div>
</body>
</html>
输出:
Spinner icons