ページ上にjQueryUIのドラッグ可能なオブジェクトと並べ替え可能なオブジェクトがあります。
ドラッグ可能な要素から並べ替え可能な要素に要素をドラッグすると、ドラッグされた要素がページの左上にジャンプします。
デモは次のとおりです:http://jsfiddle.net/travisrussi/aBhDu/1/
再現するには:
- 「アイテム5」をドラッグ可能なdiv(上のボックス)からソート可能なdiv(下のボックス)にドラッグします。
実結果:
- アイテム5は、並べ替え可能なものの上にドラッグすると左上隅にジャンプします-http ://i.stack.imgur.com/474OP.jpg
ドラッグされた要素が相対位置から絶対位置に切り替わるように見えます。ドラッグされた「li」は次の場所から切り替わります。
<li class="ui-state-default ui-draggable" style="position: relative; left: 52px; top: 9px;">Item 3</li>
これに:
<li class="ui-state-default ui-draggable ui-sortable-helper" style="position: absolute; left: 67px; top: 91px; width: 80px; height: 20px;">Item 3</li>
ドラッグ可能なアイテムがソート可能なオブジェクトにドラッグされたとき。
これは、jQueryUI 1.8.12の関連するスニペットです(3041行目から始まります)。
//The element's absolute position on the page minus margins
this.offset = this.currentItem.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
};
// Only after we got the offset, we can change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css("position", "absolute");
this.cssPosition = this.helper.css("position");
$.extend(this.offset, {
click: { //Where the click happened, relative to the element
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
parent: this._getParentOffset(),
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
});
//Generate the original position
this.originalPosition = this._generatePosition(event);
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
使用していない構成オプションはありますか?
CSSに問題はありますか?
それとも、これはjqueryUIのバグですか?