Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
9e20d4ad81f86ac1c228901ec2ddfd32904650ce
1 parent
46346312
update for make the recommend-for-you be sent after scroll. code review by LZF
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
21 deletions
static/js/product/recommend-for-you-product-desc.js
static/js/product/recommend-for-you-product-desc.js
View file @
9e20d4a
...
...
@@ -10,28 +10,47 @@ var Swiper = require('yoho.iswiper'),
var
recommendSwiper
,
$recommendForYou
=
$
(
'.recommend-for-you'
),
preferenceUrl
=
$
(
'#preferenceUrl'
).
val
();
if
(
preferenceUrl
)
{
$
.
get
(
preferenceUrl
).
then
(
function
(
html
)
{
if
(
html
.
length
<
5
)
{
$recommendForYou
.
css
(
'display'
,
'none'
);
}
else
{
$recommendForYou
.
html
(
html
).
show
();
if
(
$
(
'#swiper-recommend'
).
length
)
{
recommendSwiper
=
new
Swiper
(
'#swiper-recommend'
,
{
slidesPerView
:
'auto'
,
grabCursor
:
true
,
slideElement
:
'a'
,
lazyLoading
:
true
,
watchSlidesVisibility
:
true
});
preferenceUrl
=
$
(
'#preferenceUrl'
).
val
(),
winH
=
$
(
window
).
height
(),
end
=
false
,
requesting
=
false
;
function
request
()
{
if
(
requesting
||
end
)
{
return
;
}
requesting
=
true
;
if
(
preferenceUrl
)
{
$
.
get
(
preferenceUrl
).
then
(
function
(
html
)
{
if
(
html
.
length
<
5
)
{
$recommendForYou
.
css
(
'display'
,
'none'
);
}
else
{
$recommendForYou
.
html
(
html
).
show
();
if
(
$
(
'#swiper-recommend'
).
length
)
{
recommendSwiper
=
new
Swiper
(
'#swiper-recommend'
,
{
slidesPerView
:
'auto'
,
grabCursor
:
true
,
slideElement
:
'a'
,
lazyLoading
:
true
,
watchSlidesVisibility
:
true
});
}
}
}
window
.
rePosFooter
();
requesting
=
false
;
end
=
true
;
}).
fail
(
function
()
{
$recommendForYou
.
hide
();
});
}).
fail
(
function
()
{
$recommendForYou
.
hide
();
});
}
}
$
(
window
).
scroll
(
function
()
{
if
(
!
end
||
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
50
)
{
request
();
}
});
...
...
Please
register
or
login
to post a comment