長さが数百行になる可能性のあるレポートがあります。これは、カスタマイズされたセクションをドラッグすると、報告書はjQuery sortableです。jquery sortable list - ソートスタート時にリストを縮小し、ソート停止時に展開する
カスタマイズしたセクションを新しい位置にドラッグしたいときに、レポートの各セクション(30セクションまで)を使用可能なサイズに縮小することを決めました。
はしかし、私は2つの問題を抱えている:私は一時的に、ユーザがソートされている間、レポートセクションを記述したテキストの行で各セクションの内容を置き換えるにはどうすればよい
1) - すなわち:SECTION 1、および;
2)ユーザーがドラッグ/ソートを停止すると、縮小された各セクションのサイズを元のサイズに戻し、実際の/元のテキスト/データを表示するにはどうすればよいですか。
私はsortstartとsortstopを使用して基本フレームワークを取得しましたが、それ以上のことはありません。
ここには、jsfiddleの例があります。ここで
は私のHTMLコードです:ここで
<ul id="sortableReportDetails" class="noselect">
<li class="ui-state-default">Section 1 <br />Section 1 <br />Section 1 <br />Section 1 <br /></li>
<li class="ui-state-default">Section 2</li>
<li class="ui-state-default">Section 3<br />Section 3<br />Section 3<br />Section 3<br />Section 3<br />Section 3<br />Section 3<br />Section 3<br />Section 3<br /></li>
<li class="ui-state-default">Section 4<br />Section 4<br />Section 4<br />Section 4<br /></li>
<li class="ui-state-default">Section 5<br />Section 5<br />Section 5<br /></li>
<li class="ui-state-default">Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br />Section 6<br /></li>
<li class="ui-state-default">Section 7</li>
</ul>
は私のCSSのcoddeである:ここで
#sortableReportDetails { list-style-type: none; margin: 0; padding: 0; border: 1px solid yellowgreen; background: violet !important; }
#sortableReportDetails li { border: 1px dotted darkred; background: limegreen; cursor: pointer; cursor: hand; }
html>body #sortableReportDetails li { }
.ui-state-highlight { height: 5em; margin-bottom: 5px; margin-top: 5px; border: 1px dashed hotpink; background: royalblue !important; text-align: center; color: blueviolet; }
.ui-sortable-helper { display: none; border: 1px dashed yellowgreen; background: darkorange !important; color: aquamarine; }
.ui-state-default:hover li { border: 1px dashed beige; background: darkseagreen; cursor: pointer; cursor: hand; }
.sortable_message { color: crimson; text-align: center; vertical-align: middle; }
は私のjQueryの/ jsのコードです:
$(function() {
// settings: https://api.jqueryui.com/sortable/
$("#sortableReportDetails").sortable({
containment: "parent",
cursor: "n-resize",
opacity: "0.4",
placeholder: "ui-state-highlight",
scrollSpeed: 20 // The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance.
});
$("#sortableReportDetails").disableSelection();
$('#sortableReportDetails').on('sortstart', function(event, ui) {
$('.ui-state-highlight').append('<span class="sortable_message">Move Details Here</span>');
$('#sortableReportDetails li').height(15);
});
$('#sortableReportDetails').on('sortstop', function(event, ui) {
$('#sortableReportDetails li').height(80);
});
});
このような何かを? https://jsfiddle.net/3wtk2rej/ – madalinivascu
madalin ivascu、まさにこのような何か、これはまさにこのようなものではありません!ありがとう、非常に感謝します。これを回答として投稿すると、私はあなたに答えを与えます。 – user1261774