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
xuqi
9 years ago
Commit
d9c8bbdfaf77ecc62360ab559b50ce788004c20f
1 parent
8d849552
fix guang detail
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
54 deletions
static/js/guang/detail.js
template/m.yohobuy.com/partials/layout/use.phtml
static/js/guang/detail.js
View file @
d9c8bbd
...
...
@@ -11,8 +11,7 @@ var $ = require('jquery'),
var
$authorIntro
=
$
(
'.author .intro'
);
var
isEzinPage
=
false
,
isIphone
=
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
>
0
?
true
:
false
;
var
pageInIscroll
=
false
;
var
hasCollocationBlock
=
$
(
'.collocation-block'
).
length
>
0
?
true
:
false
;
...
...
@@ -42,7 +41,7 @@ function posCollocationArrow($curCo) {
backgroundPosition
:
bgPos
+
' bottom'
});
if
(
isIphone
&&
!
isEzinPage
)
{
if
(
pageInIscroll
)
{
$fixedThumbContainer
.
css
({
backgroundPosition
:
bgPos
+
' bottom'
});
...
...
@@ -62,7 +61,7 @@ function thumbTouchEvt(e) {
$thumbs
.
filter
(
'.focus'
).
removeClass
(
'focus'
);
if
(
isIphone
&&
!
isEzinPage
)
{
if
(
pageInIscroll
)
{
if
(
$curCo
.
closest
(
'.fixed-thumb-container'
).
length
>
0
)
{
$brother
=
$thumbContainer
;
}
else
{
...
...
@@ -86,7 +85,7 @@ function thumbTouchEvt(e) {
//
lazyLoad
(
$curProds
.
find
(
'.lazy'
));
if
(
isIphone
&&
!
isEzinPage
)
{
if
(
pageInIscroll
)
{
if
(
myScroll
)
{
myScroll
.
scrollToElement
(
scrollToEl
,
400
);
}
...
...
@@ -99,14 +98,6 @@ function thumbTouchEvt(e) {
myScroll
&&
myScroll
.
refresh
();
}
if
(
isIphone
&&
!
isEzinPage
)
{
if
(
$
(
'.yoho-header'
).
length
>
0
)
{
$
(
'#wrapper'
).
addClass
(
'ios has-head'
);
}
else
{
$
(
'#wrapper'
).
addClass
(
'ios'
);
}
}
ellipsis
.
init
();
lazyLoad
(
$
(
'.lazy'
));
...
...
@@ -122,45 +113,6 @@ if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
$authorIntro
.
css
(
'padding-top'
,
0
);
}
//有搭配模块,iphone使用iscroll初始化滚动并有固定的搭配栏,其他的没有
if
(
hasCollocationBlock
)
{
$coBlock
=
$
(
'.collocation-block'
);
$thumbContainer
=
$coBlock
.
children
(
'.thumb-container'
);
$thumbs
=
$thumbContainer
.
find
(
'li'
);
$prods
=
$coBlock
.
find
(
'.prod'
);
thumbWidth
=
$thumbs
.
width
();
if
(
isIphone
)
{
$fixedThumbContainer
=
$
(
'#wrapper'
)
.
after
(
$thumbContainer
.
clone
().
addClass
(
'fixed-thumb-container fixed-bottom'
))
.
next
(
'.thumb-container'
);
//load img of fixed thumb container
lazyLoad
(
$fixedThumbContainer
.
find
(
'.lazy'
),
{
event
:
'sporty'
});
}
//Init Arrow Position
posCollocationArrow
(
$thumbs
.
filter
(
'.focus'
));
$thumbContainer
.
delegate
(
'.thumb'
,
'touchend'
,
thumbTouchEvt
);
if
(
isIphone
&&
!
isEzinPage
)
{
$fixedThumbContainer
.
delegate
(
'.thumb'
,
'touchend'
,
thumbTouchEvt
);
}
}
/**
* 初始化页面参数
*/
exports
.
init
=
function
(
flag
)
{
if
(
flag
===
true
)
{
isEzinPage
=
true
;
}
};
// 初始化iscroll
window
.
onload
=
function
()
{
var
$scroller
=
$
(
'#scroller'
),
...
...
@@ -169,7 +121,7 @@ window.onload = function() {
var
hH
=
0
,
winH
,
tcH
,
cbH
,
cbTop
,
fixedThumbDom
;
if
(
!
isIphone
||
isEzinPage
)
{
if
(
!
pageInIscroll
)
{
return
;
}
...
...
@@ -241,4 +193,50 @@ window.onload = function() {
}
$scroller
.
trigger
(
'scroll'
);
});
};
//是否使用iscroll初始化页面
//接口暴露在HTML中,使用压缩名
exports
.
i
=
function
(
useIscroll
)
{
var
isIphone
=
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
>
0
?
true
:
false
;
pageInIscroll
=
isIphone
&&
useIscroll
;
if
(
pageInIscroll
)
{
if
(
$
(
'.yoho-header'
).
length
>
0
)
{
$
(
'#wrapper'
).
addClass
(
'ios has-head'
);
}
else
{
$
(
'#wrapper'
).
addClass
(
'ios'
);
}
}
//有搭配模块,iphone使用iscroll初始化滚动并有固定的搭配栏,其他的没有
if
(
hasCollocationBlock
)
{
$coBlock
=
$
(
'.collocation-block'
);
$thumbContainer
=
$coBlock
.
children
(
'.thumb-container'
);
$thumbs
=
$thumbContainer
.
find
(
'li'
);
$prods
=
$coBlock
.
find
(
'.prod'
);
thumbWidth
=
$thumbs
.
width
();
if
(
pageInIscroll
)
{
$fixedThumbContainer
=
$
(
'#wrapper'
)
.
after
(
$thumbContainer
.
clone
().
addClass
(
'fixed-thumb-container fixed-bottom'
))
.
next
(
'.thumb-container'
);
//load img of fixed thumb container
lazyLoad
(
$fixedThumbContainer
.
find
(
'.lazy'
),
{
event
:
'sporty'
});
}
//Init Arrow Position
posCollocationArrow
(
$thumbs
.
filter
(
'.focus'
));
$thumbContainer
.
delegate
(
'.thumb'
,
'touchend'
,
thumbTouchEvt
);
if
(
pageInIscroll
)
{
$fixedThumbContainer
.
delegate
(
'.thumb'
,
'touchend'
,
thumbTouchEvt
);
}
}
};
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
d9c8bbd
...
...
@@ -25,7 +25,9 @@
{{/if}}
{{#if guangDetail}}
<script>
seajs.use('js/guang/detail');
seajs.use('js/guang/detail', function(d) {
d.i(true);
});
</script>
{{/if}}
...
...
Please
register
or
login
to post a comment