Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
1
Alpha
2
Bravo
3
Charlie
4
Delta
css
html, body { height: 100%; } body { cursor: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/106114/cursor.png") 32 32, auto; background: #eeeeee; overflow: hidden; } *, *:before, *:after { box-sizing: border-box; } .container { position: relative; top: 50%; left: 50%; width: 320px; height: 400px; opacity: 0; visibility: hidden; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .list-item { position: absolute; top: 0; left: 0; height: 90px; width: 100%; } .item-content { height: 100%; border: 0px solid rgba(123, 123, 123, 0.49804); border-radius: 4px; color: #999999; line-height: 90px; padding-left: 32px; font-size: 24px; font-weight: 400; background-color: white; box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 2px 0px; }
JavaScript
'use strict'; var rowSize = 100; var container = document.querySelector('.container'); var listItems = Array.from(document.querySelectorAll('.list-item')); var sortables = listItems.map(Sortable); var total = sortables.length; TweenLite.to(container, 0.5, { autoAlpha: 1 }); function changeIndex(item, to) { arrayMove(sortables, item.index, to); if (to === total - 1) { container.appendChild(item.element); } else { var i = item.index > to ? to : to + 1; container.insertBefore(item.element, container.children[i]); } sortables.forEach(function (sortable, index) { return sortable.setIndex(index); }); } function Sortable(element, index) { var content = element.querySelector('.item-content'); var order = element.querySelector('.order'); var animation = TweenLite.to(content, 0.3, { boxShadow: 'rgba(0,0,0,0.2) 0px 16px 32px 0px', force3D: true, scale: 1.1, paused: true }); var dragger = new Draggable(element, { onDragStart: downAction, onRelease: upAction, onDrag: dragAction, cursor: 'inherit', type: 'y' }); var sortable = { dragger: dragger, element: element, index: index, setIndex: setIndex }; TweenLite.set(element, { y: index * rowSize }); function setIndex(index) { sortable.index = index; order.textContent = index + 1; if (!dragger.isDragging) layout(); } function downAction() { animation.play(); this.update(); } function dragAction() { var index = clamp(Math.round(this.y / rowSize), 0, total - 1); if (index !== sortable.index) { changeIndex(sortable, index); } } function upAction() { animation.reverse(); layout(); } function layout() { TweenLite.to(element, 0.3, { y: sortable.index * rowSize }); } return sortable; } function arrayMove(array, from, to) { array.splice(to, 0, array.splice(from, 1)[0]); } function clamp(value, a, b) { return value < a ? a : value > b ? b : value; }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>可排序的列表-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号