...
|
...
|
@@ -7,8 +7,8 @@ require("guang/info-index.page.css") |
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
ellipsis = require('yoho-mlellipsis'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
IScroll = require('yoho-iscroll/build/iscroll-probe');
|
|
|
lazyLoad = require('yoho-jquery-lazyload');
|
|
|
//IScroll = require('yoho-iscroll/build/iscroll-probe');
|
|
|
|
|
|
var $authorIntro = $('.author .intro');
|
|
|
|
...
|
...
|
@@ -31,6 +31,10 @@ require('../common'); |
|
|
require('../plugin/wx-share')();
|
|
|
require('./detail-dynamic');
|
|
|
|
|
|
$('#wrapper').css({
|
|
|
'overflow-y': 'scroll'
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 计算搭配的箭头的位置
|
|
|
* @param $curPos 当前focus的搭配项
|
...
|
...
|
@@ -112,16 +116,15 @@ function initIscroll() { |
|
|
if ($yohoHeader.length > 0) {
|
|
|
hH = $yohoHeader.outerHeight();
|
|
|
}
|
|
|
|
|
|
myScroll = new IScroll('#wrapper', {
|
|
|
probeType: 3,
|
|
|
mouseWheel: true,
|
|
|
click: true
|
|
|
});
|
|
|
|
|
|
document.addEventListener('touchmove', function(e) {
|
|
|
e.preventDefault();
|
|
|
}, false);
|
|
|
/*
|
|
|
myScroll = new IScroll('#wrapper', {
|
|
|
probeType: 3,
|
|
|
mouseWheel: true,
|
|
|
click: true
|
|
|
});
|
|
|
document.addEventListener('touchmove', function(e) {
|
|
|
e.preventDefault();
|
|
|
}, false);
|
|
|
|
|
|
if (!hasCollocationBlock) {
|
|
|
myScroll.on('scroll', function() {
|
...
|
...
|
@@ -130,6 +133,9 @@ function initIscroll() { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
winH = $(window).height() - hH;
|
|
|
fixedThumbDom = $fixedThumbContainer[0];
|
|
|
|
...
|
...
|
@@ -137,56 +143,59 @@ function initIscroll() { |
|
|
cbH = $coBlock.outerHeight();
|
|
|
cbTop = $coBlock.offset().top - hH;
|
|
|
|
|
|
myScroll.on('scroll', function() {
|
|
|
$(window).on('scroll', function() {
|
|
|
console.log(1);
|
|
|
var sTop = -this.y;
|
|
|
var classList = fixedThumbDom.className;
|
|
|
|
|
|
if (sTop <= cbTop - winH + tcH) {
|
|
|
if (classList.indexOf('fixed-bottom') === -1) {
|
|
|
$fixedThumbContainer
|
|
|
.addClass('fixed-bottom')
|
|
|
.removeClass('hide');
|
|
|
.addClass('fixed-bottom')
|
|
|
.removeClass('hide');
|
|
|
}
|
|
|
} else if (sTop <= cbTop) {
|
|
|
if (classList.indexOf('hide') === -1) {
|
|
|
$fixedThumbContainer
|
|
|
.addClass('hide')
|
|
|
.removeClass('fixed-bottom fixed-top');
|
|
|
.addClass('hide')
|
|
|
.removeClass('fixed-bottom fixed-top');
|
|
|
}
|
|
|
} else if (sTop <= cbTop + cbH - tcH) {
|
|
|
if (classList.indexOf('fixed-top') === -1) {
|
|
|
$fixedThumbContainer
|
|
|
.addClass('fixed-top')
|
|
|
.removeClass('hide absolute')
|
|
|
.css('top', '');
|
|
|
.addClass('fixed-top')
|
|
|
.removeClass('hide absolute')
|
|
|
.css('top', '');
|
|
|
}
|
|
|
} else if (sTop <= cbTop + cbH) {
|
|
|
if (classList.indexOf('absolute') === -1) {
|
|
|
$fixedThumbContainer
|
|
|
.addClass('absolute')
|
|
|
.removeClass('fixed-top hide');
|
|
|
.addClass('absolute')
|
|
|
.removeClass('fixed-top hide');
|
|
|
}
|
|
|
fixedThumbDom.style.top = cbTop + hH + cbH - tcH - sTop + 'px';
|
|
|
} else if (sTop > cbTop + cbH) {
|
|
|
if (classList.indexOf('hide') === -1) {
|
|
|
$fixedThumbContainer
|
|
|
.addClass('hide')
|
|
|
.removeClass('absolute');
|
|
|
.addClass('hide')
|
|
|
.removeClass('absolute');
|
|
|
}
|
|
|
}
|
|
|
$scroller.trigger('scroll');
|
|
|
//$scroller.trigger('scroll');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// window onload 后重新refresh iscroll
|
|
|
window.onload = function() {
|
|
|
myScroll && myScroll.refresh();
|
|
|
};
|
|
|
/*
|
|
|
// window onload 后重新refresh iscroll
|
|
|
window.onload = function() {
|
|
|
myScroll && myScroll.refresh();
|
|
|
};
|
|
|
|
|
|
// 图片加载完成之后重新 refresh iscroll
|
|
|
$('img').on('load', function() {
|
|
|
myScroll && myScroll.refresh();
|
|
|
});
|
|
|
// 图片加载完成之后重新 refresh iscroll
|
|
|
$('img').on('load', function() {
|
|
|
myScroll && myScroll.refresh();
|
|
|
});
|
|
|
*/
|
|
|
|
|
|
// 初始化页面,包括是否使用iscorll初始化页面
|
|
|
// 接口暴露在HTML中,使用压缩名
|
...
|
...
|
@@ -231,17 +240,19 @@ $('img').on('load', function() { |
|
|
|
|
|
// offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
|
|
|
if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
|
|
|
parseInt($authorIntro.css('margin-left'), 10))) {
|
|
|
parseInt($authorIntro.css('margin-left'), 10))) {
|
|
|
$authorIntro.css('padding-top', 0);
|
|
|
}
|
|
|
/*
|
|
|
|
|
|
if (pageInIscroll) {
|
|
|
if ($('.yoho-header').length > 0) {
|
|
|
$('#wrapper').addClass('ios has-head');
|
|
|
} else {
|
|
|
$('#wrapper').addClass('ios');
|
|
|
}
|
|
|
}
|
|
|
if (pageInIscroll) {
|
|
|
if ($('.yoho-header').length > 0) {
|
|
|
$('#wrapper').addClass('ios has-head');
|
|
|
} else {
|
|
|
$('#wrapper').addClass('ios');
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
// 有搭配模块,iphone使用iscroll初始化滚动并有固定的搭配栏,其他的没有
|
|
|
if (hasCollocationBlock) {
|
...
|
...
|
@@ -270,7 +281,6 @@ $('img').on('load', function() { |
|
|
|
|
|
if (pageInIscroll) {
|
|
|
$fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -278,3 +288,4 @@ $('img').on('load', function() { |
|
|
initIscroll();
|
|
|
}
|
|
|
}());
|
|
|
|
...
|
...
|
|