...
|
...
|
@@ -331,6 +331,16 @@ define('channel', function(require, exports) { |
|
|
loopedSlides: 4
|
|
|
}),
|
|
|
|
|
|
clearOtherSlideStyle: function(swiper) {
|
|
|
var slides = swiper.slides,
|
|
|
i = 0,
|
|
|
len = 0;
|
|
|
|
|
|
for (i = 0, len = slides.length; i < len; i++) {
|
|
|
slides[i].style = null;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
nextChagneSileSize: function(swiper) {
|
|
|
var activeIndex = swiper.activeIndex,
|
|
|
slides = swiper.slides,
|
...
|
...
|
@@ -341,8 +351,6 @@ define('channel', function(require, exports) { |
|
|
if (/big\-size/.test(nextNextSlide.className)) {
|
|
|
nextSlide.style.width = "1180px";
|
|
|
}
|
|
|
|
|
|
activeSlide.style = null;
|
|
|
},
|
|
|
|
|
|
prevChangeSlideSize: function(swiper) {
|
...
|
...
|
@@ -351,7 +359,7 @@ define('channel', function(require, exports) { |
|
|
activeSlide = slides[activeIndex],
|
|
|
prevSlide = slides[activeIndex - 1];
|
|
|
|
|
|
if (/big\-size/.test(activeSlide.className)) {
|
|
|
if (/big-size/.test(activeSlide.className)) {
|
|
|
prevSlide.style.width = "1180px";
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -359,18 +367,32 @@ define('channel', function(require, exports) { |
|
|
init: function() {
|
|
|
var swiper = this.cooperateSwiper,
|
|
|
prevChangeSlideSize = this.prevChangeSlideSize,
|
|
|
nextChagneSileSize = this.nextChagneSileSize;
|
|
|
nextChagneSileSize = this.nextChagneSileSize,
|
|
|
clearOtherSlideStyle = this.clearOtherSlideStyle,
|
|
|
firstSlide = swiper.slides[swiper.activeIndex],
|
|
|
secondSlide = swiper.slides[swiper.activeIndex + 1];
|
|
|
|
|
|
$('.cooperation-slide-prev').on('click', function(e) {
|
|
|
e.preventDefault();
|
|
|
clearOtherSlideStyle(swiper);
|
|
|
prevChangeSlideSize(swiper);
|
|
|
swiper.swipePrev();
|
|
|
});
|
|
|
$('.cooperation-slide-next').on('click', function(e) {
|
|
|
e.preventDefault();
|
|
|
clearOtherSlideStyle(swiper);
|
|
|
nextChagneSileSize(swiper);
|
|
|
swiper.swipeNext();
|
|
|
});
|
|
|
|
|
|
if (firstSlide == null || secondSlide == null) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (/big-size/.test(secondSlide.className)) {
|
|
|
firstSlide.style.width = "1180px";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}).init();
|
|
|
|
...
|
...
|
@@ -445,15 +467,6 @@ define('channel', function(require, exports) { |
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
// $('.detail-slide-ctrl-prev').bind('click', function(e) {
|
|
|
// e.preventDefault();
|
|
|
// detailSwiper.swipePrev();
|
|
|
// });
|
|
|
// $('.detail-slide-ctrl-next').bind('click', function(e) {
|
|
|
// e.preventDefault();
|
|
|
// detailSwiper.swipeNext();
|
|
|
// });
|
|
|
|
|
|
$('.slide-big-ctrl-prev').bind('click', function(e) {
|
|
|
e.preventDefault();
|
|
|
detailSwiper.swipePrev();
|
...
|
...
|
@@ -472,90 +485,79 @@ define('channel', function(require, exports) { |
|
|
});
|
|
|
};
|
|
|
|
|
|
//侧栏推荐切换
|
|
|
clearInterval(timer);
|
|
|
|
|
|
function postSwitch() {
|
|
|
$('.side-related-tab').find('a').each(function(i) {
|
|
|
if ($(this).hasClass('current')) {
|
|
|
$(this).removeClass('current');
|
|
|
} else {
|
|
|
$(this).addClass('current');
|
|
|
$('.side-related-list').hide().eq(i).show();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
timer = setInterval(function() {
|
|
|
postSwitch();
|
|
|
}, 5000);
|
|
|
$('.side-related-post').on('mouseenter', function() {
|
|
|
clearInterval(timer);
|
|
|
}).on('mouseleave', function() {
|
|
|
timer = setInterval(function() {
|
|
|
postSwitch();
|
|
|
}, 5000);
|
|
|
})
|
|
|
$('.side-related-tab').on('click', 'a', function() {
|
|
|
nowIndex = $(this).index();
|
|
|
if ($(this).hasClass('current')) return;
|
|
|
$(this).addClass('current').siblings().removeClass('current');
|
|
|
$('.side-related-list').hide().eq(nowIndex).show();
|
|
|
});
|
|
|
({
|
|
|
detialImgZoom: $('.detail-slide-body').find('.box').each(function() {
|
|
|
console.log($(this));
|
|
|
$(this).imgZoom({
|
|
|
imgTag: 'pic-tip',
|
|
|
});
|
|
|
}),
|
|
|
|
|
|
init: function() {
|
|
|
|
|
|
}
|
|
|
}).init();
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 详情页面侧边栏 最新信息 切换
|
|
|
*/
|
|
|
({
|
|
|
/**
|
|
|
* setIimeout编号 以便清除
|
|
|
* @type {Number}
|
|
|
*/
|
|
|
setTimeoutNum: 0,
|
|
|
|
|
|
/**
|
|
|
* 自动切换时间
|
|
|
* @type {Number}
|
|
|
*/
|
|
|
autoSwitchTime: 5000,
|
|
|
|
|
|
/**
|
|
|
* 自动切换标签
|
|
|
* @return {Undefined}
|
|
|
*/
|
|
|
autoSwitch: function() {
|
|
|
$('.side-related-tab').find('a').each(function(i) {
|
|
|
if ($(this).hasClass('current')) {
|
|
|
$(this).removeClass('current');
|
|
|
} else {
|
|
|
$(this).addClass('current');
|
|
|
$('.side-related-list').hide().eq(i).show();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.setTimeoutNum = setTimeout(this.autoSwitch, this.autoSwitchTime);
|
|
|
},
|
|
|
|
|
|
init: function() {
|
|
|
var that = this;
|
|
|
|
|
|
// 鼠标移入 停止自动切换 移出 开始自动切换
|
|
|
$('.side-related-post').on('mouseenter', function() {
|
|
|
clearTimeout(that.setTimeoutNum);
|
|
|
}).on('mouseleave', function() {
|
|
|
that.autoSwitch();
|
|
|
});
|
|
|
|
|
|
// 点击标签 切换信息
|
|
|
$('.side-related-tab').on('click', 'a', function() {
|
|
|
nowIndex = $(this).index(".side-related-tab a");
|
|
|
if ($(this).hasClass('current')) {
|
|
|
return;
|
|
|
}
|
|
|
$(this).addClass('current').siblings().removeClass('current');
|
|
|
$('.side-related-list').hide().eq(nowIndex).show();
|
|
|
});
|
|
|
|
|
|
// 开始自动切换
|
|
|
this.autoSwitch();
|
|
|
}
|
|
|
}).init();
|
|
|
|
|
|
//右侧相关文章定位
|
|
|
// relatedPost = $('.side-related-post');
|
|
|
// relatedTop = relatedPost.offset().top;
|
|
|
// relatedH = relatedPost.outerHeight();
|
|
|
// maxH = $('.limited-goods').offset().top;
|
|
|
// $(window).on('scroll', function() {
|
|
|
// if ($('.detail-body').outerHeight() > $('.detail-side').outerHeight() && navigator.userAgent.indexOf('iPad') === -1) {
|
|
|
// relatedH = relatedPost.outerHeight();
|
|
|
// maxH = $('.limited-goods').offset().top;
|
|
|
// if ($(this).scrollTop() >= relatedTop) {
|
|
|
// relatedPost.addClass('fix');
|
|
|
// if (relatedPost.offset().top + relatedH >= maxH && relatedPost.hasClass('fix')) {
|
|
|
// relatedPost.css({
|
|
|
// 'position': 'absolute',
|
|
|
// 'top': maxH - relatedH - 10
|
|
|
// })
|
|
|
// }
|
|
|
// if ($(this).scrollTop() <= maxH - relatedH) {
|
|
|
// relatedPost.css({
|
|
|
// 'position': 'fixed',
|
|
|
// 'top': 0
|
|
|
// });
|
|
|
// }
|
|
|
// } else {
|
|
|
// relatedPost.removeClass('fix').removeAttr('style');
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
//分享按钮位置
|
|
|
// var shareOffsetTop = $(".share").offset().top;
|
|
|
// $(window).scroll(function() {
|
|
|
// scrollTop = $(window).scrollTop();
|
|
|
// maxH = $('.limited-goods').offset().top;
|
|
|
// if (shareOffsetTop - scrollTop <= 0) {
|
|
|
// $(".share").css({
|
|
|
// "position": "fixed",
|
|
|
// "top": 10
|
|
|
// });
|
|
|
// } else {
|
|
|
// $(".share").css({
|
|
|
// "position": "absolute",
|
|
|
// "top": shareOffsetTop
|
|
|
// });
|
|
|
// }
|
|
|
// console.log($(".share").offset().top + $('.share').outerHeight());
|
|
|
// console.log($('.limited-goods').offset().top);
|
|
|
// if ($(".share").offset().top + $('.share').outerHeight() > maxH) {;
|
|
|
// $(".share").css({
|
|
|
// 'position': 'absolute',
|
|
|
// 'top': maxH - $('.share').outerHeight() - 10
|
|
|
// });
|
|
|
// }
|
|
|
// });
|
|
|
};
|
|
|
|
|
|
exports.siteActivity = function() {
|
...
|
...
|
|