2
At this time the drag3
always returns the initial position, except when it is placed in the drop1
. In the complete game it has 4 drag s and 4 drop s but just 1 of each for example and give to understand how I have this, I think.
What I really want, as I said, is that all drag s go back to the starting position without refreshing the page (which is what I do in this example) when I click the button/image to restart.
$("#drag3").draggable({
revert: true,
containment: "#fundo-interno"
});
$("#drop1").droppable({
drop: function(event, ui) {
if (ui.draggable.attr('id') == 'drag3') {
$("#drag3").draggable({
revert: false,
containment: "#fundo-interno"
});
$(this)
.addClass("alterar1")
.find("p")
alert("Muito Bem !");
} else {
$(this)
.find("p")
alert("Tenta denovo !");
}
}
});
#drag3 {
float: left;
margin-left: 75px;
margin-top: 25px;
background-color: #727170;
width: 45px;
height: 45px;
}
#drop1 {
float: left;
margin-left: 20px;
margin-top: 9px;
width: 210px;
height: 180px;
float: left;
background-position: center;
border: 1px solid grey;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"></script>
<link href="https://code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<input type="reset" name="recomecar" value="Ok" id="recomecar" onclick="window.location.reload( true );">
<img src="seta.png" width="100px" height="100px">
Please show the code you already have, and point out what is causing you difficulty. As it stands, the question will certainly be closed as "too broad". Feel free to [Dit] the question with the relevant information.
– mgibsonbr
My view is aching from so much effort to read, could organize the question?
– Guilherme Nascimento