重构代码:更新滑块验证码组件
#Comment 对x轴禁止滑动 获取图片地址逻辑更改为先默认图床,再获取options.setSrc方法
This commit is contained in:
parent
7e8208d242
commit
d2cb480c97
|
@ -147,8 +147,9 @@
|
|||
img.setSrc();
|
||||
}
|
||||
img.setSrc = function () {
|
||||
var src = 'https://picsum.photos/' + that.options.width + '/' + that.options.height + '/?image=' + Math.round(Math.random() * 20);
|
||||
var src = '';
|
||||
if ($.isFunction(that.options.setSrc)) src = that.options.setSrc();
|
||||
if(!src || src === '') src = 'https://picsum.photos/' + that.options.width + '/' + that.options.height + '/?image=' + Math.round(Math.random() * 20);
|
||||
if (isIE) { // IE浏览器无法通过img.crossOrigin跨域,使用ajax获取图片blob然后转为dataURL显示
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.onloadend = function (e) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
body {
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.block {
|
||||
|
@ -126,6 +126,6 @@ body {
|
|||
transition: color .3s linear;
|
||||
}
|
||||
|
||||
.refreshIcon:hover {
|
||||
color: #6c757d;
|
||||
}
|
||||
.refreshIcon:hover {
|
||||
color: #6c757d;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue