直播商城原始碼,驗證方式之一,滑塊驗證
直播商城原始碼,驗證方式之一,滑塊驗證實現的相關程式碼
<!doctype html> <html> <head> <meta charset="utf-8"> <title>滑動驗證</title> <script src=" <style> #slider { margin:100px auto; width:300px; height:40px; position:relative; border-radius:2px; background-color:#dae2d0; overflow:hidden; text-align:center; user-select:none; -moz-user-select:none; -webkit-user-select:none } #slider_bg { position:absolute; left:0; top:0; height:100%; background-color:#7ac23c; z-index:1 } #label { width:46px; position:absolute; left:0; top:0; height:38px; line-height:38px; border:1px solid #ccc; background:#fff; z-index:3; cursor:move; color:#ff9e77; font-size:16px; font-weight:900 } #labelTip { position:absolute; left:0; width:100%; height:100%; font-size:13px; font-family:microsoft yahei,serif; color:#787878; line-height:38px; text-align:center; z-index:2 } </style> </head> <body> <div id="demo"> <div id="slider"> <div id="slider_bg"></div> <span id="label">>></span> <span id="labelTip">拖動滑塊驗證</span> </div> </div> <script> (function($, window, document, undefined) { function SliderUnlock(elm, options, success) { var me = this; var $elm = me.checkElm(elm) ? $(elm) : $; success = me.checkFn(success) ? success : function() {}; var opts = { successLabelTip: "Successfully Verified", duration: 200, swipestart: false, min: 0, max: $elm.width(), index: 0, IsOk: false, lableIndex: 0 }; opts = $.extend(opts, options || {}); me.elm = $elm; me.opts = opts; me.swipestart = opts.swipestart; me.min = opts.min; me.max = opts.max; me.index = opts.index; me.isOk = opts.isOk; me.labelWidth = me.elm.find('#label').width(); me.sliderBg = me.elm.find('#slider_bg'); me.lableIndex = opts.lableIndex; me.success = success; } SliderUnlock.prototype.init = function() { var me = this; me.updateView(); me.elm.find("#label").on("mousedown", function(event) { var e = event || window.event; me.lableIndex = e.clientX - this.offsetLeft; me.handerIn(); }).on("mousemove", function(event) { me.handerMove(event); }).on("mouseup", function(event) { me.handerOut(); }).on("mouseout", function(event) { me.handerOut(); }).on("touchstart", function(event) { var e = event || window.event; me.lableIndex = e.originalEvent.touches[0].pageX - this.offsetLeft; me.handerIn(); }).on("touchmove", function(event) { me.handerMove(event, "mobile"); }).on("touchend", function(event) { me.handerOut(); }); }; SliderUnlock.prototype.handerIn = function() { var me = this; me.swipestart = true; me.min = 0; me.max = me.elm.width(); }; SliderUnlock.prototype.handerOut = function() { var me = this; me.swipestart = false; if (me.index < me.max) { me.reset(); } }; SliderUnlock.prototype.handerMove = function(event, type) { var me = this; if (me.swipestart) { event.preventDefault(); event = event || window.event; if (type == "mobile") { me.index = event.originalEvent.touches[0].pageX - me.lableIndex; } else { me.index = event.clientX - me.lableIndex; } me.move(); } }; SliderUnlock.prototype.move = function() { var me = this; if ((me.index + me.labelWidth) >= me.max) { me.index = me.max - me.labelWidth - 2; me.swipestart = false; me.isOk = true; } if (me.index < 0) { me.index = me.min; me.isOk = false; } if (me.index + me.labelWidth + 2 == me.max && me.max > 0 && me.isOk) { $('#label').unbind().next('#labelTip').text(me.opts.successLabelTip).css({ 'color': '#fff' }); me.success(); } me.updateView(); }; SliderUnlock.prototype.updateView = function() { var me = this; me.sliderBg.animate({ 'width': me.index }, 0); me.elm.find("#label").animate({ "left": me.index + "px" }, 0) }; SliderUnlock.prototype.reset = function() { var me = this; me.index = 0; me.sliderBg.animate({ 'width': 0 }, me.opts.duration); me.elm.find("#label").animate({ left: me.index }, me.opts.duration).next("#lableTip").animate({ opacity: 1 }, me.opts.duration); me.updateView(); }; SliderUnlock.prototype.checkElm = function(elm) { if ($(elm).length > 0) { return true; } else { throw "this element does not exist."; } }; SliderUnlock.prototype.checkFn = function(fn) { if (typeof fn === "function") { return true; } else { throw "the param is not a function."; } }; window['SliderUnlock'] = SliderUnlock; })(jQuery, window, document); $(function() { var slider = new SliderUnlock("#slider", { successLabelTip: "驗證成功" }, function() { alert("驗證成功"); }); slider.init(); }) </script> </body> </html>
以上就是 直播商城原始碼,驗證方式之一,滑塊驗證實現的相關程式碼,更多內容歡迎關注之後的文章
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2854402/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【驗證碼逆向專欄】某驗“初代”滑塊驗證碼逆向分析
- 直播系統原始碼,選擇驗證方式時選擇郵箱驗證原始碼
- 【驗證碼逆向專欄】某驗三代滑塊驗證碼逆向分析
- 【驗證碼逆向專欄】某驗四代滑塊驗證碼逆向分析
- 一對一原始碼,滑塊驗證,滑塊左右滑動顯示的位置原始碼
- 短視訊直播原始碼,拖動滑塊實現圖片驗證效果原始碼
- 使用 Turing 破解滑塊驗證碼
- 影片直播app原始碼,傳送驗證碼 驗證碼識別APP原始碼
- 直播app原始碼,驗證方式選擇郵箱驗證時,自動給輸入好的郵箱傳送驗證碼APP原始碼
- 實戰8-滑塊驗證
- app直播原始碼,登入時輸入驗證碼、簡訊驗證身份APP原始碼
- 基於YOLO實現滑塊驗證碼破解YOLO
- C# 滑動驗證碼|拼圖驗證|SlideCaptchaC#IDEAPT
- 滑動驗證碼實踐
- 影片直播app原始碼,姓名,身份證input驗證過濾APP原始碼
- php短視訊原始碼,兩種基礎的滑塊元件驗證PHP原始碼元件
- Oracle 密碼驗證方式Oracle密碼
- 溫習資料演算法—js滑塊驗證碼演算法JS
- 使用F#破解滑塊驗證碼的完整流程
- 簡單幾步實現滑動驗證碼(後端驗證)後端
- 使用Go語言破解滑塊驗證碼的完整流程Go
- 網站模擬登陸的滑塊驗證碼識別網站
- 驗證碼原理及驗證
- 直播平臺原始碼,簡訊驗證碼傳送demo原始碼
- 影片直播原始碼,前端canvas動態驗證碼實現原始碼前端Canvas
- 對極驗geetest滑塊驗證碼圖片還原演算法的研究演算法
- SSL證書是如何驗證的?驗證方式推薦
- app直播原始碼,驗證時實現獲取驗證碼並顯示倒數計時的功能APP原始碼
- 阿里雲滑塊驗證失敗解決方案阿里
- 直播平臺原始碼,JavaScript表單驗證密碼強度原始碼JavaScript密碼
- 一對一聊天原始碼,驗證碼選擇輸入字母驗證原始碼
- 【記錄】KgCaptcha滑動拼圖驗證碼GCAPT
- 驗證碼---js重新整理驗證碼JS
- 直播系統程式碼,登入時常用驗證方式實現
- 小程式接入滑動驗證
- canvas實現滑動驗證Canvas
- 利用puppeteer破解極驗的滑動驗證
- Oracle的驗證方式Oracle