Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
6bfffe19999a5f89547997c22685b298c08eb977
1 parent
8c2765bd
提交gulp ge文件
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
27 deletions
static/dist/myohobuy/1.3.7/index-debug.js
static/dist/myohobuy/1.3.7/index.js
static/dist/myohobuy/1.3.7/index-debug.js
View file @
6bfffe1
...
...
@@ -5496,44 +5496,99 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
isSelected
=
isThisGoodSelected
;
}
function
preventDefault
(
event
)
{
var
e
=
event
||
window
.
event
;
function
preventDefault
(
e
)
{
e
=
e
||
window
.
event
;
e
.
preventDefault
&&
e
.
preventDefault
();
e
.
returnValue
=
false
;
}
var
$target
=
$
(
e
.
target
);
function
stopPropagation
(
e
)
{
e
=
e
||
window
.
event
;
e
.
stopPropagation
&&
e
.
stopPropagation
();
e
.
cancelBubble
=
false
;
}
if
((
$target
.
hasClass
(
'.chose-items'
)
||
$target
.
closest
(
'chose-items'
))
&&
(
$
(
'.color-list'
).
find
(
'ul'
).
not
(
'.hide'
).
find
(
'li'
).
length
>
4
||
$
(
'.size-list'
).
find
(
'ul'
).
not
(
'.hide'
).
find
(
'li'
).
length
>
4
))
{
e
.
stopPropagation
();
return
false
;
}
function
innerScroll
(
e
)
{
var
delta
=
e
.
wheelDelta
||
e
.
originalEvent
.
wheelDelta
||
e
.
detail
||
0
,
box
=
$
(
this
).
get
(
0
);
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
// 阻止冒泡到document
// document上已经preventDefault
stopPropagation
(
e
);
if
(
$
(
box
).
height
()
+
box
.
scrollTop
>=
box
.
scrollHeight
)
{
if
(
delta
<
0
)
{
preventDefault
(
e
);
return
false
;
}
}
if
(
box
.
scrollTop
===
0
)
{
if
(
delta
>
0
)
{
preventDefault
(
e
);
return
false
;
}
}
e
.
returnValue
=
false
;
}
function
disableScroll
(
e
)
{
function
disableScroll
()
{
var
startX
,
startY
;
// older FF
if
(
window
.
addEventListener
)
{
window
.
addEventListener
(
'DOMMouseScroll'
,
preventDefault
,
false
);
}
var
$choseArea
=
$
(
'.chose-panel .main .chose-items'
);
// 内部可滚
$choseArea
.
on
(
'mousewheel'
,
innerScroll
);
// 移动端touch重写
$choseArea
.
on
(
'touchstart'
,
function
(
e
)
{
startX
=
e
.
originalEvent
.
changedTouches
[
0
].
pageX
;
startY
=
e
.
originalEvent
.
changedTouches
[
0
].
pageY
;
});
// 仿innerScroll方法
$choseArea
.
on
(
'touchmove'
,
function
(
e
)
{
var
deltaX
=
e
.
originalEvent
.
changedTouches
[
0
].
pageX
-
startX
,
deltaY
=
e
.
originalEvent
.
changedTouches
[
0
].
pageY
-
startY
;
var
box
=
$
(
this
).
get
(
0
);
e
.
stopPropagation
();
// 只能纵向滚
if
(
Math
.
abs
(
deltaY
)
<
Math
.
abs
(
deltaX
))
{
e
.
preventDefault
();
return
false
;
}
if
(
$
(
box
).
height
()
+
box
.
scrollTop
>=
box
.
scrollHeight
)
{
if
(
deltaY
<
0
)
{
e
.
preventDefault
();
return
false
;
}
}
if
(
box
.
scrollTop
===
0
)
{
if
(
deltaY
>
0
)
{
e
.
preventDefault
();
return
false
;
}
}
});
window
.
onwheel
=
preventDefault
;
// modern standard
window
.
onmousewheel
=
document
.
onmousewheel
=
preventDefault
;
// older browsers, IE
window
.
ontouchmove
=
preventDefault
;
// mobile
$
(
document
).
on
(
'mousewheel'
,
preventDefault
);
$
(
document
).
on
(
'touchmove'
,
preventDefault
);
}
function
enableScroll
()
{
if
(
window
.
removeEventListener
)
{
window
.
removeEventListener
(
'DOMMouseScroll'
,
preventDefault
,
false
);
}
window
.
onmousewheel
=
document
.
onmousewheel
=
null
;
window
.
onwheel
=
null
;
window
.
ontouchmove
=
null
;
document
.
onkeydown
=
null
;
var
$choseArea
=
$
(
'.chose-panel .main .chose-items'
);
$choseArea
.
off
(
'touchstart'
);
$choseArea
.
off
(
'touchmove'
);
$choseArea
.
off
(
'mousewheel'
);
$
(
document
).
off
(
'mousewheel'
,
preventDefault
);
$
(
document
).
off
(
'touchmove'
,
preventDefault
);
}
//删除面板
...
...
@@ -5584,10 +5639,12 @@ function show(html, cb) {
}
init
();
}
$
(
'.chose-panel'
).
show
();
$num
=
$
(
'#good-num'
);
cbFn
=
cb
;
disableScroll
();
}
...
...
static/dist/myohobuy/1.3.7/index.js
View file @
6bfffe1
This diff could not be displayed because it is too large.
Please
register
or
login
to post a comment