【发布时间】:2015-11-18 14:43:06
【问题描述】:
我在我的引导页面上使用 JQUERY UI 可排序插件。如果页面滚动到顶部或中间,它会起作用。但是当我们滚动到底部并开始拖动一个项目时。页面向上滚动几个像素。我们该如何解决这个问题。 这是 HTML 标记。
<div class="col-md-offset-1 col-md-6 question-options sortable-type ui-sortable">
<div class="row individual ui-sortable-handle">
<div class="col-md-8 col-sm-8 col-xs-8 left-column-options right-border">
<h5><span class="option-serial">2. </span>
<input type="checkbox" class="hidden"><input type="radio" class="hidden"><span class="option-text">Sort option3</span></h5>
</div>
</div><div class="row individual ui-sortable-handle" style="display: block;">
<div class="col-md-8 col-sm-8 col-xs-8 left-column-options right-border">
<h5><span class="option-serial">1. </span>
<input type="checkbox" class="hidden"><input type="radio" class="hidden"><span class="option-text">Sort Option1</span></h5>
</div>
</div>
<div class="row individual ui-sortable-handle">
<div class="col-md-8 col-sm-8 col-xs-8 left-column-options right-border">
<h5><span class="option-serial">3. </span>
<input type="checkbox" class="hidden"><input type="radio" class="hidden"><span class="option-text">Sort Option4</span></h5>
</div>
</div><div class="row individual ui-sortable-handle" style="display: block;">
<div class="col-md-8 col-sm-8 col-xs-8 left-column-options right-border">
<h5><span class="option-serial">4. </span>
<input type="checkbox" class="hidden"><input type="radio" class="hidden"><span class="option-text">Sort option2</span></h5>
</div>
</div>
</div>
这是可排序的代码
$('.sortable-type').sortable({
helper: "clone",
placeholder: "sortable-helper",
start: function (e, ui) {
ui.placeholder.height(ui.helper[0].scrollHeight);
}
}).disableSelection();
占位符 CSS
.sortable-helper
{
border:1px solid red;
}
如您所见,当我开始拖动项目时,页面滚动了几个像素。
【问题讨论】:
标签: jquery css jquery-ui-sortable