Problem with Droppable
Problem with Droppable
Hello there,
this is my first post to this group - i hope i will be able to
contribute in the future, but today i will need your help.
I´m defining a droppable as follows:
/* sth before */
$(".gastcontainer").droppable({
accept: ".gast",
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function(ev, ui) {
oldParent = ev.target.parentNode
if(calcRoomFigures(this)) { // does some further evaluation
$(this).append(ui.element)
$(ui.element).css({position: 'static'})
updateRoomFigures(this)
/* #1 */
if($(oldParent).hasClass("gastcontainer")) {
updateRoomFigures(oldParent)
return
}
} else {
$("#gastliste").append(ui.element)
$(ui.element).css({position: 'static'})
zimmer = $(this).parents("div.zimmer")[0]
zm_name = $($(zimmer).find("div.info span.zimmername")[0]).html()
$("#messages").text(zm_name + " ist voll. Bitte die Person in ein
anderes Zimmer stecken.").show("slow")
setTimeout("hideMessages()", 3000)
}
}
});
/* sth after */
it works great up to #1 when i run it step by step with firebug,
i can see, that the element is added to the droptarget, just as i want
it.
but instead of just stopping here, the browser jumps to jquery-
latest.js line 1997. it there does something i don´t know, and undoes
everything that happened before, and re-attaches the dragged element
to its former parrent.
Any idea on why this happens?
Thanks a lot for your answers,
Frank