Raise a draggable on click
This commit is contained in:
parent
b961536aab
commit
0b6d9c6ba0
|
@ -17,6 +17,7 @@ $(document).ready(function() {
|
|||
cancel: "audio, video",
|
||||
distance: 10,
|
||||
stop: update_drag_info })
|
||||
.click(raise_draggable)
|
||||
.hover(function() { $(this).find(".comments").fadeIn(); },
|
||||
function() { $(this).find(".comments").fadeOut(); });
|
||||
this.find(".delete").click({ id: this.attr("id"),
|
||||
|
@ -73,6 +74,16 @@ function delete_draggable(event) {
|
|||
}, "json");
|
||||
}
|
||||
|
||||
// Raise the draggable to the foreground.
|
||||
function raise_draggable(event) {
|
||||
var max = 0;
|
||||
$(".draggable").each(function() {
|
||||
var cur = parseFloat($(this).css("z-index"));
|
||||
max = cur > max ? cur : max;
|
||||
});
|
||||
$(this).css("z-index", max + 1);
|
||||
}
|
||||
|
||||
// Update the position of a draggable on the server.
|
||||
function update_drag_info(event, ui) {
|
||||
$.post("draggables/" + ui.helper.context.id, ui.position, "json");
|
||||
|
|
Reference in a new issue