# SliderCaptcha **Repository Path**: Simlan/SliderCaptcha ## Basic Information - **Project Name**: SliderCaptcha - **Description**: 滑块验证码 Javascript + Bootstrap,用户拖动滑块完成时完成校验,支持PC端及移动端。并可以在后台保存用户校验过程的时间,精度,滑动轨迹等信息 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: http://longbowenterprise.gitee.io/slidercaptcha/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 675 - **Created**: 2019-04-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 滑块式验证码 用户拖动滑块完成时完成校验,支持PC端及移动端。并可以在后台保存用户校验过程的时间,精度,滑动轨迹等信息。 在线演示:http://longbowenterprise.gitee.io/slidercaptcha/ ## 效果图  ## 快速开始 ### 组件依赖 jQuery bootstrap font-awesome ### CSS ```html ``` 将引入样式表的 <link> 标签复制并粘贴到 <head> 中,并放在所有其他样式表之前。 ### JS ```html ``` 将引入脚本的 <script> 标签复制并粘贴到 <body> 最后面。 ## 用法 添加网页Html元素 ```html
``` ## API ### 通过 javascript 初始化控件 ```html ``` ### Options 可以根据自己需要设置宽度与高度等配置 ```html ``` 名称 | 类型 | 默认值 | 说明 | ---|---|---|--- width | integer | 280 | 背景图片宽度 height | integer | 150 | 背景图标高度 sliderL | integer | 42 | 拼图宽度 sliderR | integer | 9 | 拼图突出半径 loadingText | string | "正在加载中..." | 图片加载时显示的文本信息 failedText | string | "再试一次" | 验证失败时显示的文本信息 barText | integer | "向右滑动填充拼图" | 拖动滑块准备拖动时显示的文本信息 repeatIcon | string | "fa fa-redo" | 重新加载图标 需引用 font-awesome setSrc | function | "https://picsum.photos/{width}/{height}/?image=random" | 设置图片加载路径 onSuccess | function | *null* | 验证通过时回调此函数 onFail | function | *null* | 验证失败时回调此函数 onRefresh | function | *null* | 点击重新加载图标时回调此函数 ### 方法 ```html ``` Method | Example | Description ---|---|--- init | $('#captcha').sliderCaptcha('reset') | 重新初始化控件 reset | $('#captcha').sliderCaptcha('reset') | 重置控件 verify | $('#captcha').sliderCaptcha('verify') | 验证结果 ## 事件 无 ## Issue 请前往 [Issue](../../issues) 页面添加问题 ## 参与贡献 1. Fork 本项目 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request