你可以将下面的代码可拖动的插件后(jsfiddle):
(function ($) {
var _create = $.ui.draggable.prototype._create;
$.ui.draggable.prototype._create = function() {
var self = this;
self.element.mousedown(function (e) {
self._mouseStart(e);
self._trigger('start', e);
self._clear();
});
_create.call(self);
};
})(jQuery);
或者,您可能希望将它做成一个单独的选项如下(jsfiddle):
(function ($) {
$.ui.plugin.add('draggable', 'increaseZindexOnmousedown', {
create: function() {
this.mousedown(function (e) {
var inst = $(this).data('draggable');
inst._mouseStart(e);
inst._trigger('start', e);
inst._clear();
});
}
});
})(jQuery);
我不明白你,你想要什么意思与堆栈值? – Fatih 2010-12-12 14:38:20
您是指z-index值? – WaiLam 2010-12-12 14:40:18
我想我误解了你的问题。你的意思是,你根本不想拖动它们*,你只是想点击它们来改变它们的堆叠顺序。如果这是正确的,那么忽略我的答案,这将无济于事。 – 2010-12-12 15:14:40