diff --git a/static/js/guang/detail.js b/static/js/guang/detail.js index 3798d26..ac82327 100644 --- a/static/js/guang/detail.js +++ b/static/js/guang/detail.js @@ -163,14 +163,21 @@ exports.init = function (flag) { // 初始化iscroll window.onload = function() { - var $scroller = $('#scroller'); + var $scroller = $('#scroller'), + $yohoHeader = $('.yoho-header'); - var winH, tcH, cbH, cbTop, fixedThumbDom; + var hH = 0, + winH, tcH, cbH, cbTop, fixedThumbDom; if (!isIphone || isEzinPage) { return; } + //考虑通用头部的影响:对offset().top以及winH做对应偏移 + if ($yohoHeader.length > 0) { + hH = $yohoHeader.outerHeight(); + } + myScroll = new IScroll('#wrapper', { probeType: 3, mouseWheel: true, @@ -188,12 +195,12 @@ window.onload = function() { return; } - winH = $(window).height(); + winH = $(window).height() - hH; fixedThumbDom = $fixedThumbContainer[0]; - tcH = $thumbContainer.height(); - cbH = $coBlock.height(); - cbTop = $coBlock.offset().top; + tcH = $thumbContainer.outerHeight(); + cbH = $coBlock.outerHeight(); + cbTop = $coBlock.offset().top - hH; myScroll.on('scroll', function() { var sTop = -this.y; @@ -224,7 +231,7 @@ window.onload = function() { .addClass('absolute') .removeClass('fixed-top hide'); } - fixedThumbDom.style.top = cbTop + cbH - tcH - sTop + 'px'; + fixedThumbDom.style.top = cbTop + hH + cbH - tcH - sTop + 'px'; } else if (sTop > cbTop + cbH) { if (classList.indexOf('hide') === -1) { $fixedThumbContainer diff --git a/static/sass/guang/_detail.scss b/static/sass/guang/_detail.scss index db0793a..2fc44b0 100644 --- a/static/sass/guang/_detail.scss +++ b/static/sass/guang/_detail.scss @@ -38,6 +38,10 @@ $clothes: sprite-map("guang/clothes/*.png"); &.has-head { top: 90rem / $pxConvertRem; + + + .fixed-top { + top: 90rem / $pxConvertRem; + } } } diff --git a/static/sass/layout/_header.scss b/static/sass/layout/_header.scss index 9bbab78..3e97370 100644 --- a/static/sass/layout/_header.scss +++ b/static/sass/layout/_header.scss @@ -6,6 +6,7 @@ overflow: hidden; height: 90rem / $pxConvertRem; line-height: 90rem / $pxConvertRem; + z-index: 1; &.boys { @include background-image(linear-gradient(#323232, #414141));