vward vward - 4 months ago 10
jQuery Question

Drag and drop game - why isn't it working now I've moved it to another domain?

Earlier this year I did some work on a drag and drop game. It was the first thing I'd coded other than basic html. I got it working but then had to put it to one side for a while.

I've now come back to work on it. The game I had created was put on the ftp of a domain I no longer have. I took the html and image files and put them on another domain expecting them to work. However now nothing drags!

I don't know what could be different. I can barely remember how I coded this in the first place. Is there an additional file that should be on the ftp or something like that? Can anyone shed any light?

Game: http://www.vic-taylor.com/dolls/doll6.html

Code:

<!doctype html>
<html lang="en">
<head>


<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js"></script>


<script>
$(function() {
$( "#draggable" ).draggable()
});
</script>

<script>
$(function() {
$( "#draggable2" ).draggable();
});
</script>

<script>
$(function() {
$( "#draggable3" ).draggable();
});
</script>

<script>
$(function() {
$( "#draggable4" ).draggable();
});
</script>

<script>
$(function() {
$( "#draggable5" ).draggable();
});
</script>


</head>
</body>

<div id="bodies/palepd.gif">
<img src="bodies/palepd.gif" class="ui-widget-content" id="draggable">
<img src="bodies/trousers.gif" class="ui-widget-content" id="draggable2">
<img src="bodies/top.gif" class="ui-widget-content" id="draggable3">
<img src="bodies/dress.gif" class="ui-widget-content" id="draggable4">
<img src="bodies/coat.gif" class="ui-widget-content" id="draggable5">
</div>


</body>

Answer

For starters, your HTML has this error:

<div id="bodies/palepd.gif">

I would suggest changing your code to reference an exact version of jquery, not just the latest version. This is because jquery and jquery-ui versions need to be compatible.

Comments