@wikala/spmkt 2.23.0 → 2.24.0
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/components/Product/AddToCart.vue +41 -11
- package/package.json +1 -1
|
@@ -236,6 +236,44 @@ export default {
|
|
|
236
236
|
GoogleAnalyticsEEC.productView(this.eecProduct())
|
|
237
237
|
//console.log('addtocart ', this.selectedVariant, this.product_id)
|
|
238
238
|
}
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
handleScroll() {
|
|
242
|
+
if (this.$mq !== 'mobile') {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const element = this.$el
|
|
246
|
+
const pagetop = document.querySelector('#pagetop')
|
|
247
|
+
const elementPosition = element.getBoundingClientRect().top
|
|
248
|
+
|
|
249
|
+
function checkPosition() {
|
|
250
|
+
const scrollPosition = window.scrollY
|
|
251
|
+
|
|
252
|
+
if (scrollPosition > elementPosition) {
|
|
253
|
+
element.classList.add('add-to-cart-fixed-footer')
|
|
254
|
+
pagetop.classList.add('pos2');
|
|
255
|
+
} else {
|
|
256
|
+
element.classList.remove('add-to-cart-fixed-footer');
|
|
257
|
+
pagetop.classList.remove('pos2');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
window.addEventListener('scroll', checkPosition);
|
|
262
|
+
checkPosition();
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
handleBusEvents() {
|
|
266
|
+
this.$bus.$on('selectVariant', this.onSelectVariant)
|
|
267
|
+
|
|
268
|
+
if (!this.headless) {
|
|
269
|
+
this.$bus.$on('updateQty', (qty) => {
|
|
270
|
+
console.log('received updateQty', qty)
|
|
271
|
+
this.qty = qty
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
if (this.headless) {
|
|
275
|
+
this.initHeadless()
|
|
276
|
+
}
|
|
239
277
|
}
|
|
240
278
|
},
|
|
241
279
|
|
|
@@ -254,17 +292,9 @@ export default {
|
|
|
254
292
|
}
|
|
255
293
|
})
|
|
256
294
|
|
|
257
|
-
this
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.$bus.$on('updateQty', (qty) => {
|
|
261
|
-
console.log('received updateQty', qty)
|
|
262
|
-
this.qty = qty
|
|
263
|
-
})
|
|
264
|
-
}
|
|
265
|
-
if (this.headless) {
|
|
266
|
-
this.initHeadless()
|
|
267
|
-
}
|
|
295
|
+
this.handleBusEvents()
|
|
296
|
+
this.handleScroll()
|
|
297
|
+
|
|
268
298
|
}
|
|
269
299
|
}
|
|
270
300
|
</script>
|