Code

Discussion on Spin2Win Wheel - Spin It 2 Win It!

Discussion on Spin2Win Wheel - Spin It 2 Win It!

Cart 2,150 sales

chrisgannon supports this item

Supported

This author's response time can be up to 5 business days.

699 comments found.

I want to know, it can be use in javascript framework (react/vue) ?

So sorry – I totally missed your question. I am working on a React version but it’s not ready yet.

Thanks for making a great piece of code, it’s very useful but I have 3 questions I can’t seem to figure out and would be greatful if you could answer.

1) For my project I have removed the end game notice (since the user can spin as many times as they like) however I now have no way of closing the toast box and my attempts to change the code have not provided a solution. Is it possible to add a close cross to the popup toast box

2) Failing that, can you point me in the right direction to make either of the following modifications a) A link in the toast box to trigger the spin again, ie so you can say “result of first spin, click here to have another go” or B) Can you make it redirect to another page entirely instead of showing a pop up, so people could either be taken to another page saying no win thanks for playing or a page that gives detail of their win.

Thanks for any help you could provide

You can allow infinite spins by setting numSpins:-1 in the JSON.

Does that help?

sorry no, I’m fine with the infinite spins I have sorted that. It’s the popup box is not closing so I need to either add a close button, redirect it or have a spin again link. I would prefer just the script I need to put in an A tag to make it close the toast modal box, trying to add this myself has not worked

Ok try these steps:

1. In Spin2WinWheel.js, outside the main Spin2WinWheel function write
  Spin2WinWheel.hideToast = function () {
   alert('closing toast'); // <-- you can remove this
    toast.style.visibility = 'hidden';
  }
https://snipboard.io/Gy9b1F.jpg

2. In index.html find the .toast and under the p tag write

<a href="#" onclick="Spin2WinWheel.hideToast(); return false;">CLOSE</a>
https://snipboard.io/2XTmyE.jpg

Hi, can this software be customized to my concept to use real money? kindly can me if it can be done. Thank you

How you use it is really up to you. Spin2Win Wheel has been used for all sorts of things over the years because it’s very flexible so I don’t see why not.

The server keeps misfiring – just refresh it please!

I have links in the text popup and they work but open in same window. Is there a way to make the link open in a new window. I tried standard target=”_blank” in the code but that breaks the wheel.

I tried this and it works fine:

https://snipboard.io/7xCMzo.jpg

The JSON data is in double quotes so try using single quotes in your URL.

Dear Support,

Is “Spin2Win Wheel” able to make it into half like this https://prnt.sc/szvzg7 ?

Thanks!

You could put it inside a container that’s half the wheel’s height and set the container’s overflow:hidden maybe?

Looking for help with adding to my site, I have it all added properly but it is calling a function undefined.

Purchase Code: f2a54dda-5718-4584-b423-86655f3def7b

Don’t really need installation help this might be a bug/something I’m missing but I read and followed the docs to a T

Can you send me a link via a private message (DM)?

Hi Support,

Do you have another link to test the Spin2win Wheel because the live preview is not working.

Thanks!

Try it again. Sometimes the server misfires :(

Hi there, it is okay now. thanks!

I have downloaded the code and running on my local machine. Unfortunately facing an error in console of blocked cors . This retricting the json loading. Error as follows- Access to XMLHttpRequest at ‘file:///C:/Users/GULSHAN%20JI/Downloads/codecanyon-N5SXUQJp-spin2win-wheel-spin-it-2-win-it/wheel_data.json’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

Because it loads data use an HTTP request, it must be run on a web server.

See this FAQ:

https://codecanyon.net/item/spin2win-wheel-spin-it-2-win-it/16337656/faqs/28306

If you need an offline version I can supply it, just bear in mind the data for the wheel will be in JavaScript and not JSON.

Hi Chrisgannon! I have several doubts, I bought the product and would like to know:

1. How can I insert the result in the mysql database, I tried several times with ajax and it was not, if you can give me a code example I will be grateful!

2. How can I find out what item the person won? Because the code displays this “console.log (‘Spin Count:’ + e.spinCount + ‘’ + ‘Win:’ + e.win + ‘’ + ‘Message:’ + e.msg);”

Great! Please bear in mind that the license covers one instance of the wheel. If you want to use it on multiple sites you must buy a license for each instance. So if you use it on 4 sites you must buy 4 licenses. Cheers!

Hello chrisgannon, I did the test of the link you sent (about sending to the database) but it didn’t work, the following error appears on the console:

ReferenceError not captured: $ is not defined in myResult (index.js: 23) > =

$(document).ready(function(){ $(’#spin’).click(function(){ $.ajax({ url: ‘save.php’, type: ‘POST’, data: {item:e.userData.prize, itemt:e.userData.typeprize}, success: function(result){ alert(“save!”); } });

});
});

this is my php:

include ‘config.php’; $item=$_POST[‘item’]; $itemt=$_POST[‘itemt’]; $date = date(‘d/m/Y H:i:s’); $sql = “INSERT INTO `wheel_history`(`User`, `Item`, `Date`) VALUES (‘Fred’,’$item – $itemt’,’$date’)”; if (mysqli_query($conn, $sql)) { echo json_encode(array(“statusCode”=>200)); } else { echo json_encode(array(“statusCode”=>201)); } mysqli_close($conn);

- continued error on the console - in showResult (Spin2WinWheel.js: 802) in Object.spinComplete (Spin2WinWheel.js: 714) in Object.h._callback (TweenMax.min.js: 16) in Object.h.render (TweenMax.min.js: 17) in Object.h.render (TweenMax.min.js: 17) in Object.D._updateRoot.G.render (TweenMax.min.js: 17) in Object.h.dispatchEvent (TweenMax.min.js: 16) in s (TweenMax.min.js: 16) myResult @ index.js: 23 showResult @ Spin2WinWheel.js: 802 Why are you reporting this page? h._callback @ TweenMax.min.js: 16 h.render @ TweenMax.min.js: 17 h.render @ TweenMax.min.js: 17 D._updateRoot.G.render @ TweenMax.min.js: 17 h.dispatchEvent @ TweenMax.min.js: 16 s @ TweenMax.min.js: 16 requestAnimationFrame (asynchronous)

It looks like you’re using jQuery syntax but jQuery is not loaded.

Please either load jQuery or better still, code in plain JavaScript.

Hi Chris – this is really cool. Nice job! I have everyone customized (colors, points, etc.) I want to return the winning point value to a database. I decided a hidden input and then assign it to e.userData.score, then doing the work after submitting. The problem is when I put a form tag around the container div it tries to submit the form before the wheel is done spinning. Any tips on this? I would be happy to send you a screen capture of what I’m talking about.

Chris – I figured out to change <button> to <input type=”button”> and it worked. My apologies.

Great – no probs!

Hi, Just tried to test the code and very new in coding. Just got few question. 1. How can I paste result to modal at the end? 2. How can I put facebook button (share result & like page) at the end of modal?

Thanks in advance.

Not sure what you’re trying to do but I don’t recommend putting a script tag in a text field.

Thanks, I will do another way.

1 more question how can I adjust size of SVG in Wheel?

{probability, "type": "image", "value": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/35984/tip_sqr.svg", "win": false, "resultText": "NOBODY LIKES A SQUARE :(", "userData": {score}},

OK, Found parameter alreadt. Sorry

Hi! Could you please tell me if this spinner will work if loaded into Adobe Connect or Webex Meetings?

Thanks!

If Webex or Adobe Connect can display a web page then yes no problem. i quickly made this using OBS https://youtu.be/eUjv1zL67i0 – pretty cool uh?

Hello! Love this wheel during lockdown for covid, using it to play online games with staff. Just need some help. Trying to use the wheel_data.php file.

Here is a snippet of my code:

$check = ’”#c50000”, ”#90251d”, ”#516e38”, ”#000000”, ”#FFC300”, ”#3c8490”, ”#516e38”, ”#90251d”, ”#2509A0”, ”#D110BA”, ”#000000”, ”#516e38”, ”#90251d”, ”#c50000”’; $word = “LOSE”; $data = array( “colorArray” => array($check),

“segmentValuesArray” => array( ),

array(
"probability" => 20,
"type" => "string",
"value" => "$word",
"win" => false,
"resultText" => "YOU Lose!",
"userData" => array("score" => 10)

For some reason, the value of $word will show “LOSE” on the wheel no issue. The colors though, only show black colors.

If I put the values directly in eg: “colorArray” => array(#c50000”, ”#90251d”, ”#516e38”, ”#000000”, ”#FFC300”, ”#3c8490”, ”#516e38”, ”#90251d”, ”#2509A0”, ”#D110BA”, ”#000000”, ”#516e38”, ”#90251d”, ”#c50000”),

Then it works no issue. Any idea what might be stopping colorArray to use the variable value? Has me pretty stumped so figured I would give here a shot!

I worked it out :)

I needed to put them into an array itself and then plug in array:

“colorArray” => $wedgeColours, instead of “colorArray” => array($colors);

Ha I have literally spent this morning trying to work out your issue! Glad it’s sorted – stay safe!

Hi there, I’m wondering can we use unicode to display non-latin characters (from foreign languages) on the wheel, and in fields like introText and resultText? how would we go about this?

No idea. Maybe try it and let us know?

Hello, I have a problem with the wheel size. I have made 0 modification at the code yet. But the wheel appears very big and don’t know how to fix it easily.

https://nsa40.casimages.com/img/2020/04/17/200417112132418822.png

Thanks you

It’s responsive so it will fill the viewPort. It seems lots of customers want to put the wheel in their own container so this is a recent change I made at their request. So I recommend putting the wheel in your own container and control that with CSS – let me know how you get on and if you need any help.

hi chrisgannon, can i use this in ASP project instead of PHP?

No reason why not. All the PHP does is return JSON so providing your can write your ASP to return the correct JSON format (which isn’t a complicated structure) then go for it.

Hi Chris, I have a question – the ticking sound doesn’t seem to be working, and I can’t figure out why. I’ve hosted the game on 000webhost and embedded the game in a Wix page, ensuring that the “hasSound” boolean is set to “true”. Have you come across an issue like this before?

Are you running it on mobile? If so iOS and Android don’t allow audio unless it has been triggered with an interaction. You can get around this by having a popup at the start that asks ‘Allow audio?’ and when they click ‘Yes’ you trigger the click sound silently. After that it should be play.

If you’re on desktop I can’t think of a reason why it isn’t playing. Speakers off?

It occurred to me that maybe you didn’t upload the audio file OR it’s in the wrong directory that your page can’t access.

thanks Chris. it’s working now, thank you!

Hi,

I edit wheel color, prize in json file , but the spin wheel still the same. Please help

Sounds like you need to clear your cache (servers sometimes cache JSON files to speed up delivery, especially as they don’t often change).

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey