Skip to content

Commit 025640f

Browse files
author
zpfz
committed
test: v0.1.3
1 parent 96bd89c commit 025640f

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

test/index.js

+22-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* RVerify.js v0.1.1
2+
* RVerify.js
33
* (c) 2020 Feng L.H.
44
* Released under the MIT License.
55
*/
@@ -16,7 +16,7 @@
1616

1717
var RVerify = {};
1818

19-
RVerify.version = '0.1.1';
19+
RVerify.version = '0.1.3';
2020

2121
var Settings = {
2222
mask: 0.5,
@@ -104,7 +104,10 @@
104104
maskImg = $('.rv-image-mask'),
105105
maskSuccess = $('.rv-image-mask-success'),
106106
maskError = $('.rv-image-mask-error'),
107-
footer = $('.rv-extra');
107+
footer = $('.rv-extra'),
108+
109+
html = $('html');
110+
108111

109112
var distance = bar.offsetWidth - slider.offsetWidth;
110113
// Flag
@@ -126,6 +129,8 @@
126129
}
127130

128131
// Init
132+
// add touch-action style in <html></html>
133+
html.setAttribute('style', 'touch-action:pan-y !important;');
129134
mask.style['background-color'] = 'rgba(0, 0, 0,' + Settings.mask + ')';
130135
mask.style['z-index'] = Settings.zIndex;
131136
wrap.style['z-index'] = Settings.zIndex;
@@ -140,6 +145,8 @@
140145
close.onclick = function () {
141146
result = 2;
142147
root.parentNode.remove();
148+
// remove touch-action style in <html></html>
149+
html.removeAttribute('style');
143150
callback(result);
144151
};
145152

@@ -148,6 +155,8 @@
148155
if (Settings.maskClosable == true) {
149156
result = 2;
150157
root.parentNode.remove();
158+
// remove touch-action style in <html></html>
159+
html.removeAttribute('style');
151160
callback(result);
152161
}
153162
};
@@ -198,6 +207,8 @@
198207
setTimeout(function () {
199208
result = 1;
200209
root.parentNode.remove();
210+
// remove touch-action style in <html></html>
211+
html.removeAttribute('style');
201212
callback(result);
202213
}, Settings.duration);
203214
} else {
@@ -208,12 +219,16 @@
208219
slider.classList.add('rv-slider-error');
209220
setTimeout(function () {
210221
img.src = getRandomImg(Settings.album);
211-
maskImg.style.cssText = '';
212-
maskError.style.cssText = '';
222+
// maskImg.style.cssText = '';
223+
maskImg.removeAttribute('style');
224+
// maskError.style.cssText = '';
225+
maskError.removeAttribute('style');
213226
slider.classList.remove('rv-slider-error');
214-
control.style.animation = '';
227+
// control.style.animation = '';
228+
control.removeAttribute('style');
215229
slider.style.left = 0;
216-
img.style.transform = 'rotate(' + currentAngle + 'deg)';
230+
img.style.transform = 'rotate(' + RandomAngle(Settings.tolerance) + 'deg)';
231+
currentAngle = getImgAngle();
217232
slider.style.transition =
218233
'background .2s ease-in-out,border-color .2s ease-in-out,box-shadow .2s ease-in-out,left .5s ease-in-out';
219234
img.style.transition = 'transform .5s ease-in-out';

test/style.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
.rv-wrap .rv-content .rv-image img,
6363
.rv-wrap .rv-content .rv-image .rv-image-mask {
6464
border-radius: 50%;
65-
max-width: 152px;
66-
max-height: 152px;
65+
width: 152px;
66+
height: 152px;
6767
user-select: none;
6868
}
6969
.rv-wrap .rv-content .rv-image .rv-image-mask {

0 commit comments

Comments
 (0)