From c32bebd1bd28d158b017bb1dd7f95fb1d8a8d567 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Mon, 11 Feb 2013 23:29:48 -0500 Subject: Draggable: Account for z-index set in CSS for the stack option. Fixed #9077 - Draggable: stack option resets the z-index --- ui/jquery.ui.draggable.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 9a31add7c..b8d21bd80 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -917,13 +917,12 @@ $.ui.plugin.add("draggable", "stack", { if (!group.length) { return; } - min = parseInt(group[0].style.zIndex, 10) || 0; + min = parseInt($(group[0]).css("zIndex"), 10) || 0; $(group).each(function(i) { - this.style.zIndex = min + i; + $(this).css("zIndex", min + i); }); - this[0].style.zIndex = min + group.length; - + $(this[0]).css("zIndex", (min + group.length)); } }); -- cgit v1.2.3 From 3d39d8c32f7b4777c8272fbdd9d24d54ca00dffc Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Tue, 12 Feb 2013 21:27:21 -0500 Subject: Removing unnecessary wrapping of this in draggable's stack option handling. --- ui/jquery.ui.draggable.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index b8d21bd80..8b388d166 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -908,9 +908,8 @@ $.ui.plugin.add("draggable", "snap", { $.ui.plugin.add("draggable", "stack", { start: function() { - var min, - o = $(this).data("ui-draggable").options, + o = this.data("ui-draggable").options, group = $.makeArray($(o.stack)).sort(function(a,b) { return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); }); @@ -921,8 +920,7 @@ $.ui.plugin.add("draggable", "stack", { $(group).each(function(i) { $(this).css("zIndex", min + i); }); - - $(this[0]).css("zIndex", (min + group.length)); + this.css("zIndex", (min + group.length)); } }); -- cgit v1.2.3