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