# SliderCaptcha **Repository Path**: myjava/SliderCaptcha ## Basic Information - **Project Name**: SliderCaptcha - **Description**: 滑块验证码,用户通过拖动滑块完成校验,支持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-11 - **Last Updated**: 2022-06-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 滑块式验证码 用户通过拖动滑块行为来完成校验,支持PC端及移动端。可以将用户拖动行为的时间、精度,滑动轨迹等信息到服务器,然后进行后台算法验证。 ## 在线演示 单页面演示:http://longbowenterprise.gitee.io/slidercaptcha/ 项目内演示:http://argo.zylweb.cn/ (本项目为开源后台管理框架 [[BootstrapAdmin](https://gitee.com/LongbowEnterprise/BootstrapAdmin)]) **输入三次错误密码后第四次出现滑块式行为验证码** ## 效果图   ## 快速开始 ### 组件依赖 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/?image=random" | 设置图片加载路径 onSuccess | function | *null* | 验证通过时回调此函数 onFail | function | *null* | 验证失败时回调此函数 onRefresh | function | *null* | 点击重新加载图标时回调此函数 ### 方法 ```html ``` Method | Example | Description ---|---|--- init | $('#captcha').sliderCaptcha('init') | 重新初始化控件 reset | $('#captcha').sliderCaptcha('reset') | 重置控件 verify | $('#captcha').sliderCaptcha('verify') | 验证结果 ## 事件 无 ## Issue 请前往 [Issue](../../issues) 页面添加问题 ## 参与贡献 1. Fork 本项目 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request