增加功能:滑块式验证码增加本地图片,如果远程随机图出现问题后加载本地图片

This commit is contained in:
Argo-MacBookPro 2019-03-30 17:37:25 +08:00
parent af01434cc7
commit 7d7af71559
6 changed files with 4 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -126,6 +126,9 @@
var getRandomNumberByRange = function (start, end) {
return Math.round(Math.random() * (end - start) + start);
};
var localImg = function () {
return $.format('../images/Pic{0}.jpg', Math.round(Math.random() * 4));
};
var img = new Image();
img.crossOrigin = "Anonymous";
img.onload = function () {
@ -144,7 +147,7 @@
that.text.text(that.text.attr('data-text'));
};
img.onerror = function () {
img.setSrc();
img.src = localImg();
}
img.setSrc = function () {
var src = '';