|
1 | 1 | /*
|
2 |
| - * RVerify.js v0.1.1 |
| 2 | + * RVerify.js |
3 | 3 | * (c) 2020 Feng L.H.
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
|
16 | 16 |
|
17 | 17 | var RVerify = {};
|
18 | 18 |
|
19 |
| - RVerify.version = '0.1.1'; |
| 19 | + RVerify.version = '0.1.3'; |
20 | 20 |
|
21 | 21 | var Settings = {
|
22 | 22 | mask: 0.5,
|
|
104 | 104 | maskImg = $('.rv-image-mask'),
|
105 | 105 | maskSuccess = $('.rv-image-mask-success'),
|
106 | 106 | maskError = $('.rv-image-mask-error'),
|
107 |
| - footer = $('.rv-extra'); |
| 107 | + footer = $('.rv-extra'), |
| 108 | + |
| 109 | + html = $('html'); |
| 110 | + |
108 | 111 |
|
109 | 112 | var distance = bar.offsetWidth - slider.offsetWidth;
|
110 | 113 | // Flag
|
|
126 | 129 | }
|
127 | 130 |
|
128 | 131 | // Init
|
| 132 | + // add touch-action style in <html></html> |
| 133 | + html.setAttribute('style', 'touch-action:pan-y !important;'); |
129 | 134 | mask.style['background-color'] = 'rgba(0, 0, 0,' + Settings.mask + ')';
|
130 | 135 | mask.style['z-index'] = Settings.zIndex;
|
131 | 136 | wrap.style['z-index'] = Settings.zIndex;
|
|
140 | 145 | close.onclick = function () {
|
141 | 146 | result = 2;
|
142 | 147 | root.parentNode.remove();
|
| 148 | + // remove touch-action style in <html></html> |
| 149 | + html.removeAttribute('style'); |
143 | 150 | callback(result);
|
144 | 151 | };
|
145 | 152 |
|
|
148 | 155 | if (Settings.maskClosable == true) {
|
149 | 156 | result = 2;
|
150 | 157 | root.parentNode.remove();
|
| 158 | + // remove touch-action style in <html></html> |
| 159 | + html.removeAttribute('style'); |
151 | 160 | callback(result);
|
152 | 161 | }
|
153 | 162 | };
|
|
198 | 207 | setTimeout(function () {
|
199 | 208 | result = 1;
|
200 | 209 | root.parentNode.remove();
|
| 210 | + // remove touch-action style in <html></html> |
| 211 | + html.removeAttribute('style'); |
201 | 212 | callback(result);
|
202 | 213 | }, Settings.duration);
|
203 | 214 | } else {
|
|
208 | 219 | slider.classList.add('rv-slider-error');
|
209 | 220 | setTimeout(function () {
|
210 | 221 | 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'); |
213 | 226 | slider.classList.remove('rv-slider-error');
|
214 |
| - control.style.animation = ''; |
| 227 | + // control.style.animation = ''; |
| 228 | + control.removeAttribute('style'); |
215 | 229 | slider.style.left = 0;
|
216 |
| - img.style.transform = 'rotate(' + currentAngle + 'deg)'; |
| 230 | + img.style.transform = 'rotate(' + RandomAngle(Settings.tolerance) + 'deg)'; |
| 231 | + currentAngle = getImgAngle(); |
217 | 232 | slider.style.transition =
|
218 | 233 | 'background .2s ease-in-out,border-color .2s ease-in-out,box-shadow .2s ease-in-out,left .5s ease-in-out';
|
219 | 234 | img.style.transition = 'transform .5s ease-in-out';
|
|
0 commit comments