slidercaptcha.js jQuery拖动滑块图片拼图验证码插件


slidercaptcha.js  jQuery拖动滑块图片拼图验证码插件

第一步引入bfwone

第二部执行插件代码

  bready(function() {
            use(["slidercaptcha", "slidercaptcha|bootstrap"], function() {
                $('#captcha').sliderCaptcha({
                    repeatIcon: 'fa fa-redo',
                    setSrc: function () {
                        return 'http://images.sdgxgz.com/Pic' + Math.round(Math.random() * 136) + '.jpg';
                    },
                    onSuccess: function () {

                        alert('验证通过!');
                    }
                });

            });
        });

完整示例如下可直接编辑运行

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>
    <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>

    <!--图标样式-->
    <link href="https://cdn.bootcss.com/font-awesome/5.7.2/css/all.min.css" rel="stylesheet">
    
    <style>
        .slidercaptcha {
            margin: 0 auto;
            width: 314px;
            height: 286px;
            border-radius: 4px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
            margin-top: 40px;
        }

        .slidercaptcha .card-body {
            padding: 1rem;
        }

        .slidercaptcha canvas:first-child {
            border-radius: 4px;
            border: 1px solid #e6e8eb;
        }

        .slidercaptcha.card .card-header {
            background-image: none;
            background-color: rgba(0, 0, 0, 0.03);
        }

        .refreshIcon {
            top: -54px;
        }
    </style>

    <script type="text/javascript">
        bready(function() {
            use(["slidercaptcha", "slidercaptcha|bootstrap"], function() {
                $('#captcha').sliderCaptcha({
                    repeatIcon: 'fa fa-redo',
                    setSrc: function () {
                        return 'http://images.sdgxgz.com/Pic' + Math.round(Math.random() * 136) + '.jpg';
                    },
                    onSuccess: function () {

                        alert('验证通过!');
                    }
                });

            });
        });
    </script>
</head>
<body>
    <div class="container-fluid">
        <div class="form-row">
            <div class="col-12">
                <div class="slidercaptcha card">
                    <div class="card-header">
                        <span>请完成安全验证</span>
                    </div>
                    <div class="card-body">
                        <div id="captcha"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</body>
</html>



立即下载slidercaptcha.js查看所有js插件

网友评论0

程序员在线工具箱