代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>滑动验证 - layui滑动验证</title>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<link rel="stylesheet" href="layui/css/layui.css" />
<style>
.pro_name a {
color: #4183c4;
}
.osc_git_title {
background-color: #fff;
}
.osc_git_box {
background-color: #fff;
}
.osc_git_box {
border-color: #e3e9ed;
}
.osc_git_info {
color: #666;
}
.osc_git_main a {
color: #9b9b9b;
}
</style>
</head>
<body>
<div class="layui-container">
<div class="layui-row" style="margin-top: 50px">
<div class="layui-col-md6">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input
type="text"
name="title"
required
lay-verify="required"
placeholder="请输入标题"
autocomplete="off"
class="layui-input"
/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">滑动验证</label>
<div class="layui-input-block">
<div id="slider"></div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">
立即提交
</button>
<button class="layui-btn" type="button" id="reset">
重置滑块
</button>
<button type="reset" class="layui-btn layui-btn-primary">
重置
</button>
</div>
</div>
</form>
</div>
<div class="layui-col-md6">
<script
src="https://gitee.com/jishudaquan/sliderValidate/widget_preview"
async
defer
></script>
<div id="osc-gitee-widget-tag"></div>
</div>
</div>
<div style="
text-align: center;
margin-top: 530px;
">Copyright ©s6.design, All Rights Reserved.
蜀ICP备19020745号-1</div>
</div>
</body>
<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
layui
.config({
base: "dist/sliderVerify/",
})
.use(["sliderVerify", "jquery", "form"], function () {
var sliderVerify = layui.sliderVerify,
$ = layui.jquery,
form = layui.form;
var slider = sliderVerify.render({
elem: "#slider",
onOk: function () {
//当验证通过回调
layer.msg("滑块验证通过");
},
});
$("#reset").on("click", function () {
slider.reset();
});
//监听提交
form.on("submit(formDemo)", function (data) {
if (slider.isOk()) {
layer.msg(JSON.stringify(data.field));
} else {
layer.msg("请先通过滑块验证");
}
return false;
});
});
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。