Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
leizi929
Sortable
提交
6f72f4ea
S
Sortable
项目概览
leizi929
/
Sortable
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Sortable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6f72f4ea
编写于
2月 04, 2016
作者:
R
RubaXa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
+ dragClass
上级
99680382
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
5 deletion
+18
-5
README.md
README.md
+1
-0
Sortable.js
Sortable.js
+13
-5
st/app.css
st/app.css
+4
-0
未找到文件。
README.md
浏览文件 @
6f72f4ea
...
...
@@ -64,6 +64,7 @@ var sortable = new Sortable(el, {
draggable
:
"
.item"
,
// Specifies which items inside the element should be sortable
ghostClass
:
"
sortable-ghost"
,
// Class name for the drop placeholder
chosenClass
:
"
sortable-chosen"
,
// Class name for the chosen item
dragClass
:
"
sortable-drag"
,
// Class name for the dragging item
dataIdAttr
:
'
data-id'
,
forceFallback
:
false
, // ignore the HTML5 DnD behaviour and force the fallback to kick in
...
...
Sortable.js
浏览文件 @
6f72f4ea
...
...
@@ -14,6 +14,7 @@
module
.
exports
=
factory
();
}
else
if
(
typeof
Package
!==
"
undefined
"
)
{
//noinspection JSUnresolvedVariable
Sortable
=
factory
();
// export for Meteor.js
}
else
{
...
...
@@ -228,6 +229,7 @@
draggable
:
/
[
uo
]
l/i
.
test
(
el
.
nodeName
)
?
'
li
'
:
'
>*
'
,
ghostClass
:
'
sortable-ghost
'
,
chosenClass
:
'
sortable-chosen
'
,
dragClass
:
'
sortable-drag
'
,
ignore
:
'
a, img
'
,
filter
:
null
,
animation
:
0
,
...
...
@@ -371,7 +373,7 @@
dragEl
.
draggable
=
_this
.
nativeDraggable
;
// Chosen item
_toggleClass
(
dragEl
,
_this
.
options
.
chosenClass
,
true
);
_toggleClass
(
dragEl
,
options
.
chosenClass
,
true
);
// Bind the events: dragstart/dragend
_this
.
_triggerDragStart
(
touch
);
...
...
@@ -448,8 +450,11 @@
_dragStarted
:
function
()
{
if
(
rootEl
&&
dragEl
)
{
var
options
=
this
.
options
;
// Apply effect
_toggleClass
(
dragEl
,
this
.
options
.
ghostClass
,
true
);
_toggleClass
(
dragEl
,
options
.
ghostClass
,
true
);
_toggleClass
(
dragEl
,
options
.
dragClass
,
false
);
Sortable
.
active
=
this
;
...
...
@@ -473,7 +478,6 @@
var
target
=
document
.
elementFromPoint
(
touchEvt
.
clientX
,
touchEvt
.
clientY
),
parent
=
target
,
groupName
=
'
'
+
this
.
options
.
group
.
name
+
''
,
i
=
touchDragOverListeners
.
length
;
if
(
parent
)
{
...
...
@@ -550,6 +554,7 @@
_toggleClass
(
ghostEl
,
options
.
ghostClass
,
false
);
_toggleClass
(
ghostEl
,
options
.
fallbackClass
,
true
);
_toggleClass
(
ghostEl
,
options
.
dragClass
,
true
);
_css
(
ghostEl
,
'
top
'
,
rect
.
top
-
parseInt
(
css
.
marginTop
,
10
));
_css
(
ghostEl
,
'
left
'
,
rect
.
left
-
parseInt
(
css
.
marginLeft
,
10
));
...
...
@@ -582,6 +587,8 @@
_dispatchEvent
(
this
,
rootEl
,
'
clone
'
,
dragEl
);
}
_toggleClass
(
dragEl
,
options
.
dragClass
,
true
);
if
(
useFallback
)
{
if
(
useFallback
===
'
touch
'
)
{
// Bind touch events
...
...
@@ -1193,9 +1200,10 @@
rect
=
lastEl
.
getBoundingClientRect
();
// 5 — min delta
// abs — нельзя добавлять, а то глюки при наведении сверху
return
(
(
abs
(
evt
.
clientY
-
(
rect
.
top
+
rect
.
height
)
)
>
5
)
||
(
abs
(
evt
.
clientX
-
(
rect
.
right
+
rect
.
width
)
)
>
5
)
(
evt
.
clientY
-
(
rect
.
top
+
rect
.
height
)
>
5
)
||
(
evt
.
clientX
-
(
rect
.
right
+
rect
.
width
)
>
5
)
)
&&
lastEl
;
}
...
...
st/app.css
浏览文件 @
6f72f4ea
...
...
@@ -51,6 +51,10 @@ ul {
opacity
:
.2
;
}
#foo
.sortable-drag
{
background
:
#daf4ff
;
}
img
{
border
:
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录