699 comments found.
I’m very sorry for the annoyance, but I have one more question. How can I update json file after every spin? In fact I only need to update sectors’ probabilities after every spin. Thanks in advance!
A few ways.
1. Use a script (like PHP) connected to a database to supply the JSON. Then update the database after each spin and reload the wheel (refresh the window) which calls the script.
2. Load the JSON, store that data as a local session object. Add or remove elements from the data object after each spin and reload the wheel wit the new data (but future loads will come from the locally stored data object).
Hi. Could you help me please to solve a problem with number of spins? When I click the spin button for the first time, everything works great, the wheel beautifully spins for 3-4 times. When I click the spin button for the second, third, etc. time, the wheel doesn’t spin at all. It has 1 second animation of sector changing, but it’s not spinning. How can I make it beautifully spin every time the button is clicked? Thanks!
Hi – have you changed anything at all since you downloaded it?
no, just uploaded all files on my server
onResult function also not working. I added there alert(e.msg); but nothing happens
I’very sorry. I think I had to clean my cache. Everyrhing works! I have one more question with probability. Is it possible to use float number as probibility. For example, I want to set probability of mobile phone winning to 0.01.
Can you DM me the URL please through my profile? (Don’t post it on the forum please)
You can’t use float numbers but you can get the same result by setting the highest probability to a number greater than 100 (say, 10000) and then setting the least probable value (your phone) to 1.
Hi. Today I’ve bought your plugin. It is very beautiful but I have one question. The thing which is done first is sending xhr request to get JSON settings for wheel. But the response of that request is visible to anybody in console, so anyone can see the probability and so on. Is there any way to hide the received JSON file? Thanks!
There’s a PHP file supplied – maybe use that instead and ensure it only passes back data when it receives a flag or a query. You could also encode the result somehow and decide it clientside. Just offering some ideas!
I should point out that once the data is with the client it’s out of your hands so there’s not a lot you can do. Encryption is probably your best bet.
https://stackoverflow.com/questions/36202082/how-to-hide-data-received-via-http-requestsHello Sir, I am contacting you concerning the Spin2Win application, I would like to know if you can adapt the application to our needs and it costs how much this modification.
1- we need the application to display photos and text downloaded via a database. 2- also allows us to enter a number of stock per gift (If the gift = 0, the gift will be displayed on the application but you must not win this gift). 3- If the gift is won, the stock must be de-increment for example (5 Pc to be won if 1 Pc is won, you must stay on the stcok 4 Pc) If a gift = 0 it must be displayed on the application but it must not be earned.
I remain at your disposal for any further information.
cordially
Replied via the DM you sent.
Hi,
we have setup the spin2win and one feature I liked when I bought it is the anti-cheat. Because we are going to set maybe some good product we face that seems a bit insecure on the myResult to send to a web service the results.
Someone could set a breakpoint there and the change the segment winned.
How can we prevent any javascript manipulation keep strong the system ?
Thanks a lot.
You could decide a spin destination ID in the backend to begin with and send it via a PHP script.
Then send it back using the onResult event and if you receive a different result ID then you know it’s been tampered with.
Make sense?
Btw the anti-cheat is part of the throw gesture where it measures the velocity of the throw and if it’s too slow it suggests the user has tried to place the wheel on the desired segment.
mmm looks good so then we have to create the function decide the segment winner.
How can we send that parameter ? How can I check tha anti-cheat suggestion ?
Thanks
It’s up to you how you send the parameter – it really depends on your stack.
Hi again Chris— Is there a way to add a specific color to a specific segment? Thanks.
Yes use the ‘colorArray’ in the JSON.
Check the docs here:
https://gist.github.com/chrisgannon/1afba5c07faeb9947a2e84d987200e3e#an-example-of-a-json-file-can-be-found-hereHi Chris. Yes I’ve seen that and I understand arrays a bit but I do not see how to assign a specific color from the colorArray to a specific segment in the segmentValuesArray. Thanks!
If you want the 3rd segment to be blue (where the segment at 12 o’clock is segment 1), make sure the 3rd entry in the array is a blue colour.
This is the 3rd entry:
https://snipboard.io/SI2Jxm.jpgGot it! The many colors in the original array really had me confused and though I kept trying different things, I wasn’t getting it. But I see it’s pretty obvious. Spinning the wheel over and over kept me from seeing the color pattern. My client wanted two alternating colors and one special one in 7 segments so I put the colors in the array like this— color1 color2 color3 color1 color2 color1 color2—And they all line up! Thanks!
I think this is going to be my last question--This spinner is just for fun to see funny answers so I want it to be completely random. So do I understand that to do that, I would delete probability from the segmentArrayValues so this—
{probability, “type”: “string”, “value”: “HOLIDAY FORTWO”, “win”: true, “resultText”: “You won a holiday!”, “userData”: {score}},
would become this—- {“type”: “string”, “value”: “HOLIDAY FORTWO”, “win”: true, “resultText”: “You won a holiday!”, “userData”: {score}},
And this—- array( “probability” => 20, “type” => “string”, “value” => “HOLIDAYFOR TWO”, “win” => false, “resultText” => “YOU WON A HOLIDAY!”, “userData” => array(“score” => 10)
would become this—- array( “type” => “string”, “value” => “HOLIDAYFOR TWO”, “win” => false, “resultText” => “YOU WON A HOLIDAY!”, “userData” => array(“score” => 10)
Since it is just for fun, no win or lose, no scores, I assume I could also take out the win/lose? Should I also take out userData? Or just the score part??
I WILL keep a max number of spins with gameOverText.
Thank you, Chris!
Don’t know why my question is showing up with strike-thru text. I didn’t do that!
No don’t take anything else out. Just the probability. The Win/Lose property is referenced in the JS whether you use it or not and it will break the wheel if you remove it.
THANK YOU!! I think I’m all good now!
Pre-Purchase Query. 1. Do have ReactJS Support? 2. Run offline in case there is no Internet. 3. Create Report of each spin, including wining and losing.
1. No but this is pure JS so it can run in a React environment.
2. There’s an offline version but it doesn’t detect connection and switch to it.
3. You could easily build your own report based on the result event data for each spin.
I’m having trouble with putting this on a webpage because it conflicts with the existing css styles and when I try to change anything, it messes up worse.
Why not wrap everything in a DIV with a class name and change the wheel’s CSS to have that class name at the start of all declarations
I kind of know what you’re talking about but I’ve never done that.
Then it’s time to try!
If you have a CSS property like:
.spinBtn {
color: red;
}
Make sure you wrap it inside another DIV with an id of, say, wheelWrapper.
Now change the CSS to:
#wheelWrapper .spinBtn {
color: red;
}
Very straight-forward.
Yes, I thought of this yesterday when I saw what the wheel did to my site. I know I’ve seen this and have been trying to find examples.
What would the attributes of #wheelWrapper be?
Whatever fits your site or the area the wheel is displaying.
Try
width: 100%; height: 100%;
I can’t get it to work. It’s “body” and “button” that messes everything up
I kept fiddling around with it and finally got it! It’s all working!
Excellent 
Hi Chris, I’m a newbie here and I’m not sure if this is what I need.
So, I need to embed this wheel to a page in my wordpress site, not even as a pop-up e-commerce but just so people can play around. Does this item allow me to do that?
Also, how do I customise the values and the branding once I purchased ?
Yes you can embed it using Code blocks (just bear in mind it’s not a WP plugin).
Just so you know, the wheel comprises HTML, CSS, JavaScript and a JSON text file (although you can feed it with PHP if you want).
If you are a newbie with code you might need a little help, depending on what you use to manage your pages in WP (WPBakery, Elementor etc).
I have removed your comment purely because it contains a link to the wheel. Please shares links in a direct message – thanks! 
Here’s what you wrote (minus the link)
Hi Chris, thanks for the quick reply. So I unzipped the file to modify the values in wheel_data.json, compressed it again as spin2win.zip and uploaded it to public_html in my wordpress file manager but it doesn’t seem to work as it says ‘file not found’ and it prompts my browser to download the zip. Would you mind taking a quick look at the page that I’m meant to implement this in? (the existing wheel is from another website)
As I said in the previous message, this is not a WP plugin. Uploading a ZIP to a public folder won’t do anything. You have unzip it first into a folder called, say, ‘wheel’.
Then in your browser you visit:
www.yoursite.com/wheel
Does that make sense?
Hi Chris, Yes, so I’ve already unzipped it to modifiy wheel_data.json but then where do I upload it again if not the public_html folder so I can refer www.mysite.com/wheel?
You have to create a folder called ‘wheel’ and unzip the files into that folder.
If you create it on the top level folder (public_html or web) then it should be accessible at www.mysite.com/wheel
Hi Chris, I’ve done all the steps but it won’t show on the website. Is there a way I can DM or email you a screenshot ? On your profile it only shows a field without the ability to attach a file
Yep you can DM me on my profile page (on the right)
http://codecanyon.net/user/chrisgannonDid you receive my message? I went to that link and for the life of me I can’t find anywhere to attach files or anywhere that says DM
Dear Sir,
Since the purchased date, we have not used any chance for the technical support. All our payments are blocked due to lockdown. Can you help us this time. We will surely update the support once the payment is cleared. Client is asking this change for payment clearance.
The new version is now available
Hi Sir,
I have purchased the Spin 2 wheel Application. In that spinDirection: clockwise is not working.
Please help me to resolve this issue
Sincere apologies – I temporarily removed it as it had a bug (fixed now and in the queue to be uploaded to Envato again). Please DM your email address and I will send you the updated version with this fixed.
I should remind you that your support has expired…
Btw I removed your comment with your email address. You probably don’t want that in a public forum.
Hello
We did this setting like this:
{probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: true, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-1-golden.svg”, “win”: false, “resultText”: “Tillykke, du har vundet e-bog <br/> ”Let din dag – med mad og bevægelse””, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: false, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-2-golden.svg”, “win”: true, “resultText”: ” Tillykke, du har vundet A3 plakat til download med Citat fra F. Nietzsche,<br/> ”Det er når man går de store tanker fødes”.”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: false, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-3-golden.svg”, “win”: false, “resultText”: “Tillykke, du har vundet plakat fra Dialægt <br/>”Den ivrige skridttæller”!”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-trophy.svg”, “win”: false, “resultText”: “Tillykke, du har vundet et <br/>3 mdr. gratis abonnement til pling.dk!<br/> Du vil modtage din unikke kode på mail i uge 38.”, “userData”: {prize“}} ],
But we ended out with: Total Prizes: 559 Total Prize1: 20 Total Prize2: 20 Total Prize3: 13 Total Trophy: 20
So it seems like the calcualtion do not work. We also set 0 when a we have max(prize), but that do not work either.
What do we do wrong?
Your support has expired. Please renew for further support. Thanks!
It is renewed 
Hi, i just bought your app, which is spin2win. Its cool. Here is the question, how could i possibly trigger the wheel out of the init function?
Because as soon as user click the “click to spin”, firstly i do need to check whether user has balance or not, if user has, then i want to trigger the wheel?
Thanks in advance.
let me give u an example.
$(’.ThisIsSpinButton’).click(function(e){
/* once user click .ThisIsSpinButton, inside this function, i want to check user balance FIRST, if balance is okay, then to trigger the spin process. like myWheel.start(); or something. so how can i trigger wheel spin here? That’s what i am asking? Thanks. */
})
In your case you need to assign your own click event first and let the user click it to get back the balance.
Once you get back the result (has balance) you can then trigger the init(); function with the same button.
It’s just a question of sequencing – just intercept with your own functionality first. Does that make sense?
I did assign my own click event. once click, it checks the user balance and return response. everything fine till here.
but i want user to see the wheel as soon as open the page, so i need to call the init function on page load so user can see the wheel.. Just tell me, how can i trigger the wheel when i want manually on my own?
user clicks the button, if check balance response TRUE, then trigger the spin.
getTrigger() function does not fire outside. Thanks in advance!
I did assign my own click event. once click, it checks the user balance and return response. everything fine till here.
but i want user to see the wheel as soon as open the page, so i need to call the init function on page load so user can see the wheel.. Just tell me, how can i trigger the wheel when i want manually on my own?
user clicks the button, if check balance response TRUE, then trigger the spin.
getTrigger() function does not fire outside. Thanks in advance!
I’m currently on holiday until next Monday. I can offer some help when I get back.
Okay, look forward to your help. kinda urgent. Thanks in advance.
Ok just please be aware that support is for help with the wheel’s standard operation. Your question is outside of that scope. If I can help I will but I my help will be a suggestion, not a definite ‘fix’.
okay thanks. one more thing, how can i destroy the class and re-init? i did built tab menu system. once user click the tab, i want to re-init the spin2wheel with new segments. so firstly, i do need to destroy or re-init. Thanks in advance.
I originally designed an elaborate initialisation function but quickly realised a better and quicker way to do it is just to reload the page (window.reload). It’s practically instant and barely perceptible.
I’ve had a chance to look at your question regarding displaying the wheel and only triggering a spin once a statement is true and there isn’t a simple way to do it.
However it’s possible with some extra development but because it hasn’t been requested before by other buyers, I would not put this new functionality in the core script as an option for future customers (i.e. you would have to pay for it).
We’ve had the Spin2Win wheel up on our web site for a couple of months now, and it’s working very well. For our site, the use case basically looks like this: the customer visits the detail page for a particular item for sale, spins the wheel on that page, and receives the discount that comes up on the wheel. The spinResult() function tied to the onResult event redirects to a processing page that puts the discounted item into the shopping cart.
Unfortunately, we’ve noticed a couple of users trying to cheat by spinning the wheel, and as it slows down toward the random discount, they will mash their back button if they don’t like the discount they’re getting, and simply repeat the process until they get a result they like. I was able to prevent the cheating by pre-generating the random wheel result as soon as the customer visits the page and storing it in the database, so that a particular customer will never get a different result on a particular item.
However, the site owner wants to detect (and log) the cheating attempt itself. I think the best (only?) way to do that would be to hang some code off the button that initiates the spin—if we wait until onResult is triggered, that’s too late because by then they will have mashed their back button. What the site owner wants is a way to detect that a customer clicked that spin button more than once for a particular item.
I’m not seeing an obvious way to do this and could use some help … I am guessing you wouldn’t need to see my code since it’s so closely modeled on the sample code, but if you provided a modified version of your sample code showing how I might detect and count spin button clicks, that might give me everything I need to adapt your sample to my purpose.
I hope this makes sense and would be happy to provide more info. Thank you!
—Lou
One way would be to set a sessionStorage variable which is a temporary ‘cookie’ (it’s not a cookie though) that persists as long as the tab/window is open.
https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorageWhen the user clicks, you check if the variable exists. (let’s call it clickCount)
If clickCount does not exist, create it and set it to 1 clickCount=1..
If clickCount does exist, increment it by 1 clickCount=2.
When the wheel spins and lands, it will pass back the spinCount on the onResult event, which, assuming they can only ever spin once, will always be 1.
Now you can compare the clickCount to spinCount. If they are not the same, they have clicked more than once.
Thank you Chris, this is very helpful! I think the only piece I’m missing here is exactly where I can put this code. Can you help me understand where to put JS code that would execute after the user clicks the button but before the wheel spins? Thanks!
Look in the Spin2WinWheel.js and find the getTrigger function.
That’s probably a good place to try.
Thanks and I’m sorry to keep asking questions—but my thought had been that best practice would forbid any edits to Spin2WinWheel.js, so that my code could never be clobbered by some potential future release of the “product” code. Are you saying I should put my code right in there?
Sorry for the delay – I’ve been on a much needed holiday.
You could put this functionality in the index.js.
Not sure why I suggested putting it in the getTrigger function (probably tired and in need of a holiday!).
So add the session variable code to the spin button. Now set the variable whenever it’s clicked. When the wheel finishes a spin the onResult function will send back the spinCount. If the click session variable should equal the spinCount.
Thanks for the follow-up Chris, and I hope you enjoyed your time off. I beat my head against this for a while but just now made a breakthrough. I was struggling to attach my own JavaScript to the button because I was trying to use the button’s onclick() event … but since (as far as I can tell) your code is overriding that event handler, my code never executed. I switched to onmousedown() and I was able to get my own custom JavaScript (currently “hello world”) to execute prior to the wheel spin. If you don’t hear from me again, it means I was able to build out my solution without any further obstacles. Thanks again.
Ok how’s this.
You create a second button (secondBtn) which becomes the main button on the page (the Click to Spin button).
The first, original button (firstBtn) is still on the page, hidden and you still pass this into init() as normal.
The secondBtn can now call firstBtn’s onclick event using:
secondBtn.onclick = function (e) {
//do something here
firstBtn.onclick();
}
Does that help?
Very much! Thanks to this tip I was able to make the whole process sequential and synchronous. Thank you!
Excellent! Any chance of a positive review? 
Hi. I have set the number of spins to be 3. I have different values for different segments and I want the total values to add up to a certain value after 3 spins. For example, I want the total value to be $35. So it can be $5 + $10 + $20 = $35 or $15 + $15 + $5 = $35 or any other combinations. Is this possible?
I’m not sure what you’re asking. Please clarify, thanks!
Sorry for not being clear enough. For example, my wheel consists of 5 segments, with values 1, 2, 3, 4 and 5. I have 3 spins. I want the total value to always be 10 after 3 spins. Is it doable?
You can retrieve any data you want from the winning segment (using onResult event, check the docs).
Therefore you could either set a custom userData value or just use the main segment value as the value to be included. Then on each spin you add up the segment values and do something if it equals your winning amount.
So if the winning amount is 50 and you land on 10, 25, 10 and 5 then do something.
So let’s say I want the total amount to be 50. I have 3 spins. My first 2 spins are 10 and 15. How do I ensure the third spin lands on 25? So that the total amount is exactly 50, not less and not more.
Ah I see. No you can’t determine/change the wheel’s destination once the set of spins/go has started.
I see. If that’s the case, is there any way to ensure that the wheel lands on a certain segment at least once? For example, the wheel will land on ‘10’ at least once out of 3 spins.
Yes you can totally program where the wheel lands on all spins.
Check the docs for spinDestinationArray.
Read it carefully as there are some simple rules that need to be adhered to (like removing the probability property – you don’t have probability when the destination is predetermined).
In the JSON you can define which segments the wheel will land on like this:
"spinDestinationArray":[2,12,5]
In this example there are 3 spins and the wheel will land on segment 2, then 12 then 5.
I just purchased and loaded it up, and it is huge – more than half the wheel is off the page? It looks like you may have fixed this, but apparently i did not download the corrected version? thanks
I changed it to this configuration as most buyers like to place the wheel in their own container and control that.
In the CSS try this
.wheelSVG {
position: relative;
overflow: visible;
height: 75vh;
}
And change .wheelContainer to
.wheelContainer {
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
width: 100vw
height: 100vh;
}
FYI I have just updated the wheel with this change. I originally made the change as a result of buyers requesting it but it seems that the original CSS is better!
Thanks for the updated css – got everything looking the way I want! The issue that I am now having: I have put a “url in the pop up” that will take the winners to a reward page – it is working, but on the last spin, if it is a winner, the link/pop up does not last long enough before it switches to the end on game message pop up? I like the end of game message, but is there a way to add more time before the switch? or can i set it to automatically lose on the last spin? Looking for suggestions? thanks
The FAQs are your friends! 
Hello, a few questions:
How can I set it so that there is only one segment, e.g., there is literally only one possible win. I am not talking about having multiple segments with only one being 100% probability of winning, I want simply a wheel with 1 segment (takes up the whole wheel). Is this possible?
Secondly, the wheel is too massive and has to be scrolled down to view the wheel. Is it possible to have the wheel to the left side and the text / spin the wheel button on the right side?
Hi,
The wheel needs at least 2 segments to operate – otherwise it wouldn’t spin.
Regarding the size, try this change in the CSS for .wheelSVG
.wheelSVG {
position: relative;
overflow: visible;
height: 75vh;
}
And change .wheelContainer to
.wheelContainer {
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
width: 100vw
height: 100vh;
}
Hello again, this answers the size query, however is there a way I can set the wheel up on the left and the spin button on the right?
Also, whenever I try and remove the intro text, the winning message at the end also disappears. Could you let me know how I can keep the winning text without having the “you have to spin it 2 win it” text box? Thanks (I believe it’s labeled toast)
To change the layout you will need to play around with the CSS. Try using different flexbox properties.
Again with the toast popup, you will need to hide it at the start (I recommend using JS) and then show it when the winning text happens (onResult).
These are all changes to the core scripts which support doesn’t cover. You’ll need to play around to get the result you want.
Would you be able to help with this if I paid a bit extra? I sent an email.
Oh sorry the link just said support and it takes you to what looks like a private messaging form. And I didn’t know I posted the code… How is that even possible from my url when PHP source is not accessible that way. There is no way you can get the complete script by visiting a url that uses it… I solved this anyway!
No probs at all. Oh you solved it? Great! I saw your 5 star rating – thanks! Just a reminder — your license covers one project use. If you want to use it in multiple projects you’ll need to purchase more licenses.
No problem its for a free to use incentive giving our another reason to login each day and will only be used on the one site. I know how much work, time and love that has to be poored in to a script to a standard you can feel proud of and for people to the steal from you is not right, I am totally behind your terms and respect the licence. Great job its really something!
Is there any reason you use height: 100vw; and not 100vh? The page is much better suited to 75vh & 75 vw set on wheelSVG and the container above at 100vh 100vw.
When they are both at 100 at 800px width the wheel doesn’t fit the page…
Yes I noticed that this morning and changed it
Plugin is not working.
Installing Plugin from uploaded file: codecanyon-uFuBQYvz-spin2win-wheel-spin-it-2-win-it.zip Hola! Would you like to receive automatic updates and unlock premium support? Please activate your copy of WPBakery Page Builder.
Dismiss this notice. Unpacking the package…
Installing the plugin…
The package could not be installed. No valid plugins were found.
Plugin installation failed.
Return to Plugin Installer
Hi,
That’s because it’s not an installable WP plugin. It’s a set of HTML, JS and CSS files.
https://codecanyon.net/item/spin2win-wheel-spin-it-2-win-it/16337656/faqs/29174Hi ! I read form the features that the wheel suports images or text label (or both!).
Is it a way to set on the same segment Image and Text ?
It would be grate to be available to set a text with an image.
Thanks,
I have an FAQ for that but Envato have broken my FAQ section. I have raised a ticket with them and I’ll be in touch ASAP.
Sorry for the delay – my FAQ ‘Show More’ button seem to be broken so I had to Google my own support! This FAQ might help https://codecanyon.net/item/spin2win-wheel-spin-it-2-win-it/16337656/faqs/32513