Skip to content

Commit 57a6710

Browse files
committed
Update cart-builder.html
1 parent 5853d84 commit 57a6710

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

barcode-scanner-api-samples/scan-multiple-barcodes/cart-builder.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ <h2>Simulated Shopping Cart</h2>
242242
document.addEventListener("mouseup", () => (isDragging = false));
243243

244244
dragDiv.addEventListener("touchstart", (e) => {
245+
e.preventDefault();
245246
isDragging = true;
246247
offsetX = e.touches[0].clientX - dragDiv.offsetLeft;
247248
offsetY = e.touches[0].clientY - dragDiv.offsetTop;
248249
});
249250

250251
document.addEventListener("touchmove", (e) => {
252+
e.preventDefault();
251253
if (isDragging) {
252254
dragDiv.style.left = `${e.touches[0].clientX - offsetX}px`;
253255
dragDiv.style.top = `${e.touches[0].clientY - offsetY}px`;

0 commit comments

Comments
 (0)