Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
35e4a2fa
Z
zui
项目概览
易企天创
/
zui
大约 1 年 前同步成功
通知
6
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
37
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
37
Issue
37
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35e4a2fa
编写于
6月 12, 2014
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* support mutiple targets to drop in in droppable.js.
上级
5b904a18
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
104 addition
and
53 deletion
+104
-53
assets/js/doc.js
assets/js/doc.js
+12
-5
dist/js/zui.min.js
dist/js/zui.min.js
+36
-22
javascript.html
javascript.html
+18
-4
src/apps/ranzhi/js/zui.js
src/apps/ranzhi/js/zui.js
+2
-0
src/js/droppable.js
src/js/droppable.js
+36
-22
未找到文件。
assets/js/doc.js
浏览文件 @
35e4a2fa
...
...
@@ -119,16 +119,23 @@ $(function()
{
start
:
function
()
{
$
(
'
#droppableT
arget
'
).
removeClass
(
'
panel-warning
'
).
removeClass
(
'
panel-success
'
).
find
(
'
.panel-heading
'
).
text
(
'
拖动到这里。
'
);
$
(
'
.droppable-t
arget
'
).
removeClass
(
'
panel-warning
'
).
removeClass
(
'
panel-success
'
).
find
(
'
.panel-heading
'
).
text
(
'
拖动到这里。
'
);
},
drop
:
function
()
drop
:
function
(
event
,
target
)
{
messager
.
show
(
'
真棒!
'
);
$
(
'
#droppableTarget
'
).
addClass
(
'
panel-success
'
).
find
(
'
.panel-heading
'
).
text
(
'
成功拖到目的地。
'
);
$
(
'
.droppable-target
'
).
removeClass
(
'
panel-success
'
).
removeClass
(
'
panel-warning
'
);
if
(
target
)
{
target
.
addClass
(
'
panel-success
'
).
find
(
'
.panel-heading
'
).
text
(
'
成功拖到目的地。
'
);
}
},
drag
:
function
(
event
,
isIn
)
drag
:
function
(
event
,
isIn
,
target
)
{
$
(
'
#droppableTarget
'
).
toggleClass
(
'
panel-warning
'
,
isIn
);
$
(
'
.droppable-target
'
).
removeClass
(
'
panel-success
'
).
removeClass
(
'
panel-warning
'
);
console
.
log
(
isIn
);
if
(
target
)
target
.
addClass
(
'
panel-warning
'
);
}
});
});
dist/js/zui.min.js
浏览文件 @
35e4a2fa
...
...
@@ -2314,7 +2314,8 @@ if (typeof jQuery === "undefined") { throw new Error("ZUI requires jQuery") }
if
(
isSure
!=
undefined
&&
(
!
isSure
))
return
;
}
var
$target
=
$
(
setting
.
target
),
var
$targets
=
$
(
setting
.
target
),
target
=
null
,
$container
=
$
(
setting
.
container
),
pos
=
$e
.
offset
(),
isIn
=
false
;
...
...
@@ -2337,55 +2338,68 @@ if (typeof jQuery === "undefined") { throw new Error("ZUI requires jQuery") }
function
mouseMove
(
event
)
{
var
tPos
=
$target
.
offset
();
var
mX
=
event
.
pageX
,
mY
=
event
.
pageY
,
tX
=
tPos
.
left
,
tY
=
tPos
.
top
,
tW
=
$target
.
width
(),
tH
=
$target
.
height
();
mY
=
event
.
pageY
;
$e
.
removeClass
(
'
drag-start
'
).
addClass
(
'
dragging
'
);
shadow
.
addClass
(
'
dragging
'
).
css
(
{
left
:
event
.
pageX
-
startOffset
.
x
,
top
:
event
.
pageY
-
startOffset
.
y
});
isIn
=
(
mX
>
tX
&&
mY
>
tY
&&
mX
<
(
tX
+
tW
)
&&
mY
<
(
tY
+
tH
));
$target
.
toggleClass
(
'
drop-in
'
,
isIn
);
shadow
.
toggleClass
(
'
drop-in
'
,
isIn
);
isIn
=
false
;
var
idx
=
-
1
;
$targets
.
removeClass
(
'
drop-in
'
).
each
(
function
(
index
,
el
)
{
var
t
=
$
(
this
);
var
tPos
=
t
.
offset
();
var
tW
=
t
.
width
(),
tH
=
t
.
height
(),
tX
=
tPos
.
left
,
tY
=
tPos
.
top
;
if
(
mX
>
tX
&&
mY
>
tY
&&
mX
<
(
tX
+
tW
)
&&
mY
<
(
tY
+
tH
))
{
isIn
=
true
;
target
=
t
;
idx
=
index
;
t
.
addClass
(
'
drop-in
'
);
return
false
;
}
});
$e
.
toggleClass
(
'
drop-in
'
,
isIn
);
shadow
.
toggleClass
(
'
drop-in
'
,
isIn
);
if
(
setting
.
hasOwnProperty
(
'
drag
'
)
&&
$
.
isFunction
(
setting
[
'
drag
'
]))
{
setting
[
'
drag
'
](
event
,
isIn
);
setting
[
'
drag
'
](
event
,
isIn
,
target
,
idx
);
}
}
function
mouseUp
(
event
)
{
if
(
!
isIn
)
target
=
null
;
var
isSure
=
true
;
if
(
setting
.
hasOwnProperty
(
'
beforeDrop
'
)
&&
$
.
isFunction
(
setting
[
'
beforeDrop
'
]))
{
setting
[
'
beforeDrop
'
](
event
,
isIn
);
var
isSure
=
setting
[
'
beforeDrop
'
](
event
,
isIn
,
target
);
if
(
isSure
!=
undefined
&&
(
!
isSure
))
isSure
=
false
;
else
isSure
=
true
;
}
if
(
isIn
&&
setting
.
hasOwnProperty
(
'
drop
'
)
&&
$
.
isFunction
(
setting
[
'
drop
'
]))
if
(
is
Sure
&&
is
In
&&
setting
.
hasOwnProperty
(
'
drop
'
)
&&
$
.
isFunction
(
setting
[
'
drop
'
]))
{
setting
[
'
drop
'
](
event
);
setting
[
'
drop
'
](
event
,
target
);
}
$
(
document
).
unbind
(
'
mousemove
'
,
mouseMove
).
unbind
(
'
mouseup
'
,
mouseUp
);
$target
.
removeClass
(
'
drop-in
'
);
$target
s
.
removeClass
(
'
drop-in
'
);
$e
.
removeClass
(
'
dragging
'
);
shadow
.
remove
();
if
(
setting
.
hasOwnProperty
(
'
afterDrop
'
)
&&
$
.
isFunction
(
setting
[
'
afterDrop
'
]))
{
setting
[
'
afterDrop
'
](
event
,
isIn
);
}
event
.
preventDefault
();
}
});
...
...
javascript.html
浏览文件 @
35e4a2fa
...
...
@@ -2122,16 +2122,30 @@ base_url: "./"
<div
class=
"example"
>
<div
class=
"row"
>
<div
class=
"col-md-
6
"
>
<div
class=
"col-md-
3
"
>
<div
class=
"panel"
>
<div
class=
"panel-heading"
>
开始吧
</div>
<div
class=
"panel-body"
style=
"height: 100px"
>
<button
type=
"button"
class=
'btn btn-danger btn-lg'
data-toggle=
'droppable'
data-target=
'
#droppableT
arget'
>
拖动我
</button>
<button
type=
"button"
class=
'btn btn-danger btn-lg'
data-toggle=
'droppable'
data-target=
'
.droppable-t
arget'
>
拖动我
</button>
</div>
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"panel"
id=
'droppableTarget'
>
<div
class=
"col-md-3"
>
<div
class=
"panel droppable-target"
>
<div
class=
"panel-heading"
>
拖到这里
</div>
<div
class=
"panel-body"
style=
"height: 100px"
>
</div>
</div>
</div>
<div
class=
"col-md-3"
>
<div
class=
"panel droppable-target"
>
<div
class=
"panel-heading"
>
拖到这里
</div>
<div
class=
"panel-body"
style=
"height: 100px"
>
</div>
</div>
</div>
<div
class=
"col-md-3"
>
<div
class=
"panel droppable-target"
>
<div
class=
"panel-heading"
>
拖到这里
</div>
<div
class=
"panel-body"
style=
"height: 100px"
>
</div>
...
...
src/apps/ranzhi/js/zui.js
浏览文件 @
35e4a2fa
...
...
@@ -26,3 +26,5 @@ if (typeof jQuery === "undefined") { throw new Error("ZUI requires jQuery") }
// @koala-append "../../../js/string.js"
// @koala-append "../../../js/date.js"
// @koala-append "../../../js/resize.js"
//
// @koala-append "../../../js/droppable.js"
src/js/droppable.js
浏览文件 @
35e4a2fa
...
...
@@ -38,7 +38,8 @@
if
(
isSure
!=
undefined
&&
(
!
isSure
))
return
;
}
var
$target
=
$
(
setting
.
target
),
var
$targets
=
$
(
setting
.
target
),
target
=
null
,
$container
=
$
(
setting
.
container
),
pos
=
$e
.
offset
(),
isIn
=
false
;
...
...
@@ -61,55 +62,68 @@
function
mouseMove
(
event
)
{
var
tPos
=
$target
.
offset
();
var
mX
=
event
.
pageX
,
mY
=
event
.
pageY
,
tX
=
tPos
.
left
,
tY
=
tPos
.
top
,
tW
=
$target
.
width
(),
tH
=
$target
.
height
();
mY
=
event
.
pageY
;
$e
.
removeClass
(
'
drag-start
'
).
addClass
(
'
dragging
'
);
shadow
.
addClass
(
'
dragging
'
).
css
(
{
left
:
event
.
pageX
-
startOffset
.
x
,
top
:
event
.
pageY
-
startOffset
.
y
});
isIn
=
(
mX
>
tX
&&
mY
>
tY
&&
mX
<
(
tX
+
tW
)
&&
mY
<
(
tY
+
tH
));
$target
.
toggleClass
(
'
drop-in
'
,
isIn
);
shadow
.
toggleClass
(
'
drop-in
'
,
isIn
);
isIn
=
false
;
var
idx
=
-
1
;
$targets
.
removeClass
(
'
drop-in
'
).
each
(
function
(
index
,
el
)
{
var
t
=
$
(
this
);
var
tPos
=
t
.
offset
();
var
tW
=
t
.
width
(),
tH
=
t
.
height
(),
tX
=
tPos
.
left
,
tY
=
tPos
.
top
;
if
(
mX
>
tX
&&
mY
>
tY
&&
mX
<
(
tX
+
tW
)
&&
mY
<
(
tY
+
tH
))
{
isIn
=
true
;
target
=
t
;
idx
=
index
;
t
.
addClass
(
'
drop-in
'
);
return
false
;
}
});
$e
.
toggleClass
(
'
drop-in
'
,
isIn
);
shadow
.
toggleClass
(
'
drop-in
'
,
isIn
);
if
(
setting
.
hasOwnProperty
(
'
drag
'
)
&&
$
.
isFunction
(
setting
[
'
drag
'
]))
{
setting
[
'
drag
'
](
event
,
isIn
);
setting
[
'
drag
'
](
event
,
isIn
,
target
,
idx
);
}
}
function
mouseUp
(
event
)
{
if
(
!
isIn
)
target
=
null
;
var
isSure
=
true
;
if
(
setting
.
hasOwnProperty
(
'
beforeDrop
'
)
&&
$
.
isFunction
(
setting
[
'
beforeDrop
'
]))
{
setting
[
'
beforeDrop
'
](
event
,
isIn
);
var
isSure
=
setting
[
'
beforeDrop
'
](
event
,
isIn
,
target
);
if
(
isSure
!=
undefined
&&
(
!
isSure
))
isSure
=
false
;
else
isSure
=
true
;
}
if
(
isIn
&&
setting
.
hasOwnProperty
(
'
drop
'
)
&&
$
.
isFunction
(
setting
[
'
drop
'
]))
if
(
is
Sure
&&
is
In
&&
setting
.
hasOwnProperty
(
'
drop
'
)
&&
$
.
isFunction
(
setting
[
'
drop
'
]))
{
setting
[
'
drop
'
](
event
);
setting
[
'
drop
'
](
event
,
target
);
}
$
(
document
).
unbind
(
'
mousemove
'
,
mouseMove
).
unbind
(
'
mouseup
'
,
mouseUp
);
$target
.
removeClass
(
'
drop-in
'
);
$target
s
.
removeClass
(
'
drop-in
'
);
$e
.
removeClass
(
'
dragging
'
);
shadow
.
remove
();
if
(
setting
.
hasOwnProperty
(
'
afterDrop
'
)
&&
$
.
isFunction
(
setting
[
'
afterDrop
'
]))
{
setting
[
'
afterDrop
'
](
event
,
isIn
);
}
event
.
preventDefault
();
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录