Authored by xuqi

guang detail iscroll

... ... @@ -98,33 +98,14 @@ function thumbTouchEvt(e) {
myScroll && myScroll.refresh();
}
ellipsis.init();
lazyLoad($('.lazy'));
//title mlellipsis
$('.info-list .title, .one-good .reco-name').each(function() {
this.mlellipsis(2);
});
//offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
parseInt($authorIntro.css('margin-left'), 10))) {
$authorIntro.css('padding-top', 0);
}
// 初始化iscroll
window.onload = function() {
function initIscroll() {
var $scroller = $('#scroller'),
$yohoHeader = $('.yoho-header');
var hH = 0,
winH, tcH, cbH, cbTop, fixedThumbDom;
if (!pageInIscroll) {
return;
}
//考虑通用头部的影响:对offset().top以及winH做对应偏移
if ($yohoHeader.length > 0) {
hH = $yohoHeader.outerHeight();
... ... @@ -193,15 +174,35 @@ window.onload = function() {
}
$scroller.trigger('scroll');
});
}
//window onload 后重新refresh iscroll
window.onload = function() {
myScroll && myScroll.refresh();
};
//是否使用iscroll初始化页面
//初始化页面,包括是否使用iscorll初始化页面
//接口暴露在HTML中,使用压缩名
exports.i = function(useIscroll) {
var isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;
pageInIscroll = isIphone && useIscroll;
ellipsis.init();
lazyLoad($('.lazy'));
//title mlellipsis
$('.info-list .title, .one-good .reco-name').each(function() {
this.mlellipsis(2);
});
//offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
if ($authorIntro.offset() && (parseInt($authorIntro.offset().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');
... ... @@ -237,6 +238,11 @@ exports.i = function(useIscroll) {
if (pageInIscroll) {
$fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
}
}
if (pageInIscroll) {
initIscroll();
}
};
\ No newline at end of file
... ...