@mixd-id/web-scaffold 0.1.230406189 → 0.1.230406191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406189",
4
+ "version": "0.1.230406191",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -97,7 +97,8 @@ export default{
97
97
  data(){
98
98
  return {
99
99
  index: 0,
100
- timeoutId: null
100
+ timeoutId: null,
101
+ scrollPosition: null,
101
102
  }
102
103
  },
103
104
 
@@ -206,7 +207,7 @@ export default{
206
207
  }
207
208
  else if(Math.abs(dx) > 15){
208
209
  this._props['direction'] = 'horizontal'
209
- document.body.classList.add(this.$style.noScroll)
210
+ this.disableBodyScroll()
210
211
  }
211
212
  }
212
213
  else if(this._props['direction'] === 'horizontal'){
@@ -232,6 +233,8 @@ export default{
232
233
  else{
233
234
  this.setPosition()
234
235
  }
236
+
237
+ this.enableBodyScroll()
235
238
  }
236
239
 
237
240
  window.removeEventListener('mousemove', this.mouseMove)
@@ -240,12 +243,26 @@ export default{
240
243
  window.removeEventListener('touchmove', this.mouseMove)
241
244
  window.removeEventListener('touchend', this.mouseUp)
242
245
 
243
- document.body.classList.remove(this.$style.noScroll)
244
-
245
246
  if(this.autoPlay > 0)
246
247
  this.play()
247
248
  },
248
249
 
250
+ disableBodyScroll(){
251
+ this.scrollPosition = window.pageYOffset || document.documentElement.offsetTop
252
+ document.body.style.overflow = 'hidden';
253
+ document.body.style.position = 'fixed';
254
+ document.body.style.top = `-${this.scrollPosition}px`;
255
+ document.body.style.width = '100%';
256
+ },
257
+
258
+ enableBodyScroll(){
259
+ document.body.style.removeProperty('overflow');
260
+ document.body.style.removeProperty('position');
261
+ document.body.style.removeProperty('top');
262
+ document.body.style.removeProperty('width');
263
+ window.scrollTo(0, this.scrollPosition);
264
+ },
265
+
249
266
  mouseDown(e){
250
267
  if(!this.items || this.items.length <= 1)
251
268
  return
@@ -348,8 +365,7 @@ export default{
348
365
  @apply bg-primary-500;
349
366
  }
350
367
 
351
- .noScroll{
352
- overflow: hidden
368
+ .bodyNoScroll{
353
369
  }
354
370
 
355
371
  @media screen(md){