Sortable.Js新手在這裏,所以請溫柔。列表項不使用Sortable.js
我想在我的頁面中使用Sortable.js實現一個可排序的列表。我在執行時沒有收到任何錯誤,但是當我試圖拖動我的列表項時,它們根本沒有移動。
這裏是我的HTML:
<ul id="forcedranking" class="wizard-contents-container-ul forcedRankCls" ng-show="isForcedRankingQuestion">
<div class="answers-container">
<div class="answer-child-container">
<li ng-repeat="query in currentQuestionObject.choices | orderBy:['sequence','answer']" class="listModulePopup forcedRankingChoice" data-index="{{$index}}" ng-model="query.value">
{{query.answer}}
</li>
</div>
</div>
</ul>
這是我的JS:
/* Get current input type for Clear All checkbox activation */
$scope.currentInputType = $scope.currentQuestionObject.inputType.toLowerCase();
if ($scope.currentInputType == "forced ranking") {
$scope.isForcedRankingQuestion = true;
/* SORTABLE FOR FORCED RANKING */
var mySort = document.getElementById("forcedranking");
// forcedranking is my id for the <ul>
var sortable = Sortable.create(forcedranking, {});
// Tried setting this because I thought this was the culprit. Turns out it's not.
sortable.option("disabled", false);
我打電話給我的Sortable.js像這樣(我angularJS下庫):
<script type="text/javascript" src="content1/carousel/Sortable.js"></script>
總體,我認爲Sortable是一個非常整潔的圖書館,這就是爲什麼我想讓它工作如此糟糕的原因。但我只是不知道我在這裏做錯了什麼。
阿哈哈,這是因爲文件混淆了我。但是,是的,調用ng-sortable就是這麼做的。謝謝! –