From 46e48c4082cfa7a16b5da94aceadd5110350a313 Mon Sep 17 00:00:00 2001 From: microTT <micrott526@qq.com> Date: Thu, 28 Apr 2016 20:04:22 +0800 Subject: [PATCH] 详情页最新视频/资讯开始滑动位置修改 --- res/js/channel.js | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ res/js/yohood.js | 2 +- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/res/js/channel.js b/res/js/channel.js index 5da4cf7..7bce912 100644 --- a/res/js/channel.js +++ b/res/js/channel.js @@ -399,6 +399,127 @@ define('channel', function(require, exports) { } + + // CtrlSwiper = function(option) { + // this.swiper = option.swiper; + // this.elem = $(option.elem); + // this.slides = $(option.elem).find(option.slides); + // this.nextButton = $(option.nextButton); + // this.prevButton = $(option.prevButton); + // this.slidesNum = 0; + // this.slidesPerView = option.slidesPerView; + // this.slideWitdh = option.slideWitdh; + // this.groupWidth = option.perSlideWidth; + // this.totalWidth = 0; + // this.currentGroup = 0; + // this.maxGroup = 0; + // } + + // CtrlSwiper.prototype = { + // constructor: CtrlSwiper, + + // slideTo: function(index) { + // var group = Math.floor(index / this.slidesPerView); + // if (group < 0 || group > this.maxGroup) { + // return; + // } + + // this.slideElem(this.elem, -group * this.groupWidth); + // }, + + // slideElem: function(elem, width, time) { + // time = time === undefined ? 0.3 : time; + // elem.css("transform", "translate3d(" + width + "px, 0px, 0px)").css("transition-duration", time + "s"); + // }, + + // init: function() { + // var that = this, + // swiper = this.detailCtrlSwiper, + // i = 0, + // len = 0, + // groupCount = 0; + + // this.slidesNum = this.slides.size(); + // this.groupWidth = this.slideWitdh * this.slidesPerView; + + // for (i = 0, len = this.slides.length; i < len; i++) { + // if (i % 2 === 0) { + // if (/big-size/.test(this.slides[i].className)) { + // group++; + // } else if () + // } + + + // if (i + 1 < len) { + // if (/big-size/.test(this.slides[i+1].className)) { + // this.slides[i].css("width", "1140px"); + // group++; + // } else { + + // } + // } + // } + + + // // this.totalWidth = this.slidesNum * this.slideWitdh; + + + // this.maxGroup = Math.floor(this.slidesNum / this.slidesPerView); + // this.elem.css("width", this.totalWidth + "px"); + + // // if (this.slidesNum <= 5) { + // // $(".detail-slide-ctrl-prev").hide(); + // // $(".detail-slide-ctrl-next").hide(); + // // } + + // this.prevButton.on("click", function() { + // if ((that.currentGroup - 1) >= 0) { + // that.slideElem(that.elem, -(that.currentGroup - 1) * that.groupWidth); + // that.currentGroup--; + // } else { + // that.slideElem(that.elem, -that.maxGroup * that.groupWidth, 0.1); + // that.currentGroup = that.maxGroup; + // } + // }); + + // this.nextButton.on("click", function() { + // if ((that.currentGroup + 1) <= that.maxGroup) { + // that.slideElem(that.elem, -(that.currentGroup + 1) * that.groupWidth); + // that.currentGroup++; + // } else { + // that.slideElem(that.elem, 0, 0.1); + // that.currentGroup = 0; + // } + + // }); + + // this.slides.on("click", function() { + // var index = $(this).index(this.slides); + + // $(".detail-slide-ctrl-tabs .box").find(".cover").removeClass("on"); + // $(this).find(".cover").addClass("on"); + // detailSwiper.swipeTo(index); + // }); + + // $(this.slides[0]).click(); + // } + // } + + // var ctrlTabs = new CtrlSwiper({ + // elem: ".cooperation .slide-wrap", + // slides: ".box", + // prevButton: ".cooperation .cooperation-slide-prev", + // nextButton: ".cooperation .cooperation-slide-next", + // slidesPerView: 1, + // slideWitdh: 1180 + // }); + + // ctrlTabs.init(); + + + + + /** * 首页底部合作商滑动条 */ diff --git a/res/js/yohood.js b/res/js/yohood.js index 0234e21..53297ba 100644 --- a/res/js/yohood.js +++ b/res/js/yohood.js @@ -1139,7 +1139,7 @@ define('yohood', function(require, exports) { $(window).on('scroll', function() { relatedH = relatedPost.outerHeight(); maxH = $('.yoho-nav').outerHeight() + $('.header').outerHeight() + $('.bd').outerHeight(); - if ($(this).scrollTop() >= relatedTop) { + if ($(this).scrollTop() >= relatedTop - 50) { relatedPost.addClass('fix'); if (relatedPost.offset().top + relatedH >= maxH && relatedPost.hasClass('fix')) { relatedPost.css({ -- libgit2 0.24.0