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
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
664ea046a47c209bda8c9c2341a380552ff09964
2 parents
d09d7922
05cf0f6c
Merge remote-tracking branch 'remotes/origin/develop/wap' into beta/wap
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
28 deletions
static/js/cart/chose-panel.js
static/js/cart/chose-panel.js
View file @
664ea04
...
...
@@ -71,26 +71,40 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
isSelected
=
isThisGoodSelected
;
}
function
preventDefault
(
e
)
{
console
.
log
(
e
);
if
(
e
.
target
.
localName
===
'ul'
)
return
;
e
=
e
||
window
.
event
;
if
(
e
.
preventDefault
)
function
preventDefault
(
event
)
{
var
e
=
event
||
window
.
event
;
var
$target
=
$
(
e
.
target
);
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
;
}
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
}
e
.
returnValue
=
false
;
}
function
disableScroll
(
e
)
{
if
(
window
.
addEventListener
)
// older FF
// older FF
if
(
window
.
addEventListener
)
{
window
.
addEventListener
(
'DOMMouseScroll'
,
preventDefault
,
false
);
}
window
.
onwheel
=
preventDefault
;
// modern standard
window
.
onmousewheel
=
document
.
onmousewheel
=
preventDefault
;
// older browsers, IE
window
.
ontouchmove
=
preventDefault
;
// mobile
window
.
ontouchmove
=
preventDefault
;
// mobile
}
function
enableScroll
()
{
if
(
window
.
removeEventListener
)
if
(
window
.
removeEventListener
)
{
window
.
removeEventListener
(
'DOMMouseScroll'
,
preventDefault
,
false
);
}
window
.
onmousewheel
=
document
.
onmousewheel
=
null
;
window
.
onwheel
=
null
;
window
.
ontouchmove
=
null
;
...
...
@@ -138,18 +152,6 @@ function disableNumEdit() {
function
show
(
html
,
cb
)
{
var
scrollPosition
=
[
document
.
documentElement
.
scrollLeft
||
document
.
body
.
scrollLeft
,
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
],
$html
=
$
(
'html, body'
);
// it would make more sense to apply this to body, but IE7 won't have that
$html
.
data
(
'scroll-position'
,
scrollPosition
);
$html
.
data
(
'previous-overflow'
,
$html
.
css
(
'overflow'
));
$html
.
css
(
'overflow'
,
'hidden'
);
$html
.
css
(
'height'
,
'100%'
);
window
.
scrollTo
(
scrollPosition
[
0
],
scrollPosition
[
1
]);
if
(
html
)
{
$chosePanel
.
html
(
html
);
if
(
$
(
'#promotionId'
).
val
()
!==
''
)
{
...
...
@@ -166,15 +168,7 @@ function show(html, cb) {
//隐藏当前Panel
function
hide
()
{
var
$html
=
$
(
'html, body'
),
scrollPosition
=
$html
.
data
(
'scroll-position'
);
// un-lock scroll position
$html
.
css
(
'overflow'
,
$html
.
data
(
'previous-overflow'
));
$html
.
css
(
'height'
,
'auto'
);
window
.
scrollTo
(
scrollPosition
[
0
],
scrollPosition
[
1
]);
$
(
'.chose-panel'
).
hide
();
enableScroll
();
}
...
...
Please
register
or
login
to post a comment