jquery-sortable-lists实现可拖动排序列表效果代码
代码语言:html
所属分类:菜单导航
代码描述:jquery-sortable-lists实现可拖动排序列表效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>BFW NEW PAGE</title> <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bfwone.js"></script> <script type="text/javascript"> bready(function() { use(["jquery-sortable-lists.min"], function() { var options = { placeholderCss: { 'background-color': '#ff8' }, hintCss: { 'background-color': '#bbf' }, isAllowed: function(cEl, hint, target) { var parent_id = hint.parents('li').first().data('module'); //当前 parent id var current_id = cEl.data('module'); //当前选中的选项 /** * 表示c选项只能给在自己内部排序与产生子类 */ if (hint.parents('li').first().data('module') === 'c' && cEl.data('module') !== 'c') { hint.css('background-color', '#ff9999'); return false; } else { hint.css('background-color', '#99ff99'); return true; } }, opener: { active: true, close: 'images/Remove2.png', open: 'images/Add2.png', openerCss: { 'display': 'inline-block', 'width': '18px', 'height': '18px', 'float': 'left', 'margin-left': '-35px', 'margin-right': '5px', 'background-position': 'center center', 'background-repeat': 'no-repeat' }, openerClass: '' } }, sWrapper = $('#settingsWrapper'); $('#sTree2, #sTree').sortableLists(options); $('#toArrBtn').on('click', function() { console.log($('#sTree2').sortableListsToArray()); }); $('#toHierBtn').on('click', function() { console.log($('#sTree2').sortableListsToHierarchy()); }); $('#toStrBtn').on('click', function() { console.log($('#sTree2').sortableListsToString()); }); $('.descPicture').on('click', function(e) { $(this).toggleClass('descPictureClose'); }); }); }); </script> <style> html, body, ul, li { margin: 0; padding: 0; } ul, li { list-style-type: none; color: #b5e853; border: 1px solid #3f3f3f; } ul.sTree, ul { padding: 0px; background-color: #151515; } ul.sTree2 li, ul#sortableListsBase li { padding-left: 50px; margin: 5px; border: 1px solid #3f3f3f; background-color: #3f3f3f; } li div { padding: 7px; background-color: #222; Nborder: 1px solid #3f3f3f; } li, ul, div { border-radius: 3px; } .red { background-color: #ff9999; } .blue { background-color: #aaaaff; } .green { background-color: #99ff99; } .gree2 { background-color: #bbffbb; } .yellow { background-color: #ff8; } .brown { background-color: #c26b2b; } .pT20 { padding-top: 20px; } .pV10 { padding-top: 10px; padding-bottom: 10px; } .dN { display: none; } .zI1000 { z-index: 1000; } .c1 { color: #b5e853; } .c2 { color: #63c0f5; } .c3 { color: #f77720; } .c4 { color: #888; } .bgC1 { background-color: #ccc; } .bgC2 { background-color: #ff8; } .small1 { font-size: 0.8em; } .small2 { font-size: 0.7em; } .small3 { font-size: 0.6em; } .tAR { text-align: right; } .clear { clear: both; } img.descPicture { display: block; width: 100%; margin: 0 7px 30px 0; float: left; cursor: pointer; /*transition: all 0.5s ease;*/ } img.descPicture.descPictureClose { width: 150.........完整代码请登录后点击上方下载按钮下载查看
网友评论0