$(document).ready(function () {
// renaming tokens, shadow tokens, parts of the equation and the last paragraph
var token1 = $('.token.1');
var token2 = $('.token.2');
var token3 = $('.token.3');
var shadow1 = $('.shadow.1');
var shadow2 = $('.shadow.2');
var shadow3 = $('.shadow.3');
var part1 = $('.fading.1');
var part2 = $('.fading.2');
var part3 = $('.fading.3');
var mult = $('#multiplication');
// hiding the mathematical equation and mul
$('.fading').css('visibility', 'hidden');
mult.css('visibility', 'hidden');
// This makes the shadows droppable and tells the computer what to do once the numbered tokens are dropped in the shadow tokens
$('.shadow.1, .shadow.2, .shadow.3').droppable({
drop: function (event, ui) {
event.preventDefault();
i++;
do_everything(i);
$(this).append($(ui));
},
hoverClass: 'hover'
});
// This is a longwinded switch function. So depending on the value of n, certain tokens are draggable, certain shadow tokens are visable and droppable, and certain parts of the equation are visible
var i = 0;
do_everything(0);
function do_everything(n) {
switch (n) {
case 0:
shadow1.css('visibility', 'hidden').droppable("disable");
shadow2.css('visibility', 'hidden').droppable("disable");
token1.draggable();
break;
case 1:
shadow2.css('visibility', 'visible').droppable("enable");
shadow3.css('visibility', 'hidden').droppable("disable");
token2.draggable().animate({
top: "-=44px"
});
token3.animate({
top: "-=44px"
});
part1.css('visibility', 'visible');
break;
case 2:
shadow1.css('visibility',...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.