I wrote this code:
[php]$(".make-draggable, .draggable").draggable({
helper: “clone”,
snap: “.draggable”,
snapMode: “inner”
});
$(".draggable").droppable({
drop: function(event, ui) {
var elemText = ui.draggable.text();
$(this).html(elemText);
var outB = ui.draggable.attr(‘id’).split("-");
if (outB[0] == “go”) {
var num = outB.length;
var loser;
var loserval;
var losloc;
var losid = outB[1];
var numchars = outB[1].length;
if (num === 2) {
var i = 1;
loser = (losid.charAt(0) + “-”);
for (i = 1; i < numchars; i++) {
loser = (loser+losid.charAt(i));
}
loserval = $("#go-" + loser);
losloc = ("#"+losid);
$(losloc).html(loserval.text());
} else if (num === 3) {
loser = (outB[1] + outB[2]);
loserval = $("#go-" + loser);
losloc = ("#"+loser);
$(losloc).html(loserval.text());
}
}
}
});
[/php]
which can be seen working here: http://jsfiddle.net/LjQuK/180/
I tried putting it on my site and it doesn’t work… here is the code that’s on the site:
[php]
.draggable {
cursor: move;
font-size: 11px;
width: 70px;
border-style:solid;
border-width: 1px 1px 1px 1px;
}
.make-draggable {
cursor: move;
font-size: 11px;
width: 70px;
border-style:solid;
border-width: 1px 1px 1px 1px;
z-index:2700;
}
#dropbox {
width: 100px;
height: 100px;
background: gray;
}
.match_round-drop {
width: 70px;
}?
|
<td>
</td>
<td>
<div class='match_round-drop' id='round-2:match-1'>
<div class='draggable' id='go-l5'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='go-l-5'>
<br>
</div>
</div>
<br>
<br>
<br>
<br>
<div class='match_round-drop' id='round-2:match-2'>
<div class='draggable' id='go-l7'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='go-l-7'>
<br>
</div>
</div>
</td>
<td>
</td>
<td>
<div class='match_round-drop' id='round-3:match-1'>
<div class='draggable' id='go-l11'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='go-l-11'>
<br>
</div>
</div>
</td>
<td>
</td>
<td>
Final
<div class='match_round-drop' id='round-final'>
<div class='draggable' id='winnerb'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='loserb'>
<br>
</div>
<br>
</div>
</td>
<td>
</td>
<td>
<div class='match_round-drop' id='match-16'>
<div class='draggable' id='l11'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l12'>
<br>
</div>
</div>
</td>
<td>
</td>
<td>
<div class='match_round-drop' id='match-l5'>
<div class='draggable' id='l9'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l10'>
<br>
</div>
</div>
</td>
<td>
</td>
<td>
<div class='match_round-drop' id='match-l3'>
<div class='draggable' id='l5'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l6'>
<br>
</div>
</div>
<div class='match_round-drop' id='match-l4'>
<div class='draggable' id='l7'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l8'>
<br>
</div>
</div>
</td>
<td>
</td>
<td>
<div class='match_round-drop' id='match-l1'>
<div class='draggable' id='l1'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l2'>
<br>
</div>
</div>
<div class='match_round-drop' id='match-l2'>
<div class='draggable' id='l3'>
<br>
</div>
<div class='vs'>
<center>
vs.
</center>
</div>
<div class='draggable' id='l4'>
<br>
</div>
</div>
</td>
</tr>
</table>
</center>
</td>
[/php]
Anyone have any ideas why this would be?
|