Authored by xuqi

scroll with header

... ... @@ -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
... ...
... ... @@ -38,6 +38,10 @@ $clothes: sprite-map("guang/clothes/*.png");
&.has-head {
top: 90rem / $pxConvertRem;
+ .fixed-top {
top: 90rem / $pxConvertRem;
}
}
}
... ...
... ... @@ -6,6 +6,7 @@
overflow: hidden;
height: 90rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
z-index: 1;
&.boys {
@include background-image(linear-gradient(#323232, #414141));
... ...