diff --git a/src/example/main.ts b/src/example/main.ts index ca4142a..2699c96 100644 --- a/src/example/main.ts +++ b/src/example/main.ts @@ -4,18 +4,16 @@ import { init, onRotate, getFaceByIndex } from "../"; document.querySelector("#app")!.innerHTML = `
-

1

-

2

-

3

-
- +
+ +
+
+ +
+
+ +
+
`; @@ -24,6 +22,7 @@ init("cube-3d", { width: 500, height: 500, initialRotation: 0, + swipeIntensity: 5, }); // Register a callback for when the rotation changes diff --git a/src/utils/dom.ts b/src/utils/dom.ts index 6a82f93..968f96d 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -54,8 +54,10 @@ export const getFaceElements = ( targetElement: HTMLElement, width: number, ): NodeListOf => { - // Retrieve all div elements within the target element - const faceElements = targetElement.querySelectorAll("div"); + // Retrieve all elements with the attribute "data-cube-face" within the target element + const faceElements = targetElement.querySelectorAll( + "[data-cube-face]", + ) as NodeListOf; // Apply common styles to all face elements faceElements.forEach((element) => {