<ul id="option_list" class="list" data-role="listview" data-inset="true">
<li class='row'>1</li>
<li class='row'>2</li>
<li class='row'>3</li>
</ul>
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/assets/js/jquery-ui.min.js"></script>
<script src="/assets/js/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript">
// html5 only.
$('li').removeClass('ui-corner-bottom');
$('ul')
.addClass('ui-corner-top')
.removeClass('ui-corner-all')
.sortable({
'containment': 'parent',
'opacity': 0.6,
update: function(event, ui) {
//alert("dropped");
}
});
// html5 mobile able.
$( "#option_list" ).sortable({
items: "li:not(.ui-li-divider)"
//items: ">li"
,scroll:false
//,handle: ".icon01"
//,appendTo: document.body
//,cancel: "p,a,.use01,.use02"
//items: "li img"
});
$( "#option_list" ).sortable();
$( "#option_list" ).disableSelection();
/*
$( "#option_list" ).bind("sortstop", function(event, ui) {
//alert("stop");
//$('#option_list').listview('refresh');
});
*/
</script>
touch-punch.min.js 는 모바일을 지원하기 위해 필요함
jquery-ui.min.js
0.22MB
jquery.min.js
0.08MB
jquery.ui.touch-punch.min.js
0.00MB
참고 : sortablejs.github.io/Sortable/
SortableJS
Thresholds Try modifying the inputs below to affect the swap thresholds. You can see the swap zones of the squares colored in dark blue, while the "dead zones" (that do not cause a swap) are colored in light blue. new Sortable(example7, { swapThre
sortablejs.github.io
'[ Web 관련 ] > jQuery' 카테고리의 다른 글
jQuery 웹, 모바일에 사용 할만 한 캘린더 (0) | 2020.07.07 |
---|---|
json 에서 특정 키(key)값의 값을 비교 하기(찾기) (0) | 2020.07.02 |
bootstarp modal 이벤트 사용하기 (0) | 2020.04.17 |
체크박스 체크여부 확인, 체크하기 등 (0) | 2020.03.11 |
ajax 호출 예제 (0) | 2020.02.29 |