Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Prize not found #2

Open
ghost opened this issue Mar 1, 2021 · 3 comments
Open

Uncaught Prize not found #2

ghost opened this issue Mar 1, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 1, 2021

Hello
Here's a problem. After clicking the start button I get this error in the console "Uncaught Prize not found".
Can you help me?

@Kir-Antipov
Copy link
Owner

Could you add some details, please?

What does your layout, script initialization and rotateTo method call look like?

@ThreePlant
Copy link

Could you add some details, please?

What does your layout, script initialization and rotateTo method call look like?

I'm also having this same problem.

I used the minified JS and it worked perfectly, but when I tried to use the js from the 'src' folder I had this problem on the console.

I'm checking and it seems that the problem is in the selectedPrize() getter

get selectedPrize() {
       console.log(this.prizes) // array 14 items prizes (ok!)
       let a = this.prizes
         .concat()
         .sort((c, a) => c.wrapper.offsetLeft - a.wrapper.offsetLeft)
         .find((a) => a.wrapper.offsetLeft > this.center).index

       console.log('AFTER', this.prizes[(this.prizes.length + a - 1) % this.prizes.length]) // CONSOLE LOG = rouletteJS.min.js?5ef7:110 Uncaught TypeError: Cannot read properties of undefined (reading 'index')

       return this.prizes[(this.prizes.length + a - 1) % this.prizes.length]
     }

@Makkons
Copy link

Makkons commented Feb 12, 2023

Hello, for those who will face a similar problem.
This error occurs if there are less than 10 elements in the roulette.
Just add another div inside id="rpulette" to have 10 or more.
How to run a roulette with less than 10 elements, I did not understand, because I have much more of them :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants