...
|
...
|
@@ -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();
|
|
|
}
|
|
|
}); |
...
|
...
|
|