Authored by ccbikai

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -11,7 +11,8 @@ var $ = require('jquery'),
var $authorIntro = $('.author .intro');
var isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;
var isEzinPage = false,
isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;
var hasCollocationBlock = $('.collocation-block').length > 0 ? true : false;
... ... @@ -41,7 +42,7 @@ function posCollocationArrow($curCo) {
backgroundPosition: bgPos + ' bottom'
});
if (isIphone) {
if (isIphone && !isEzinPage) {
$fixedThumbContainer.css({
backgroundPosition: bgPos + ' bottom'
});
... ... @@ -61,7 +62,7 @@ function thumbTouchEvt(e) {
$thumbs.filter('.focus').removeClass('focus');
if (isIphone) {
if (isIphone && !isEzinPage) {
if ($curCo.closest('.fixed-thumb-container').length > 0) {
$brother = $thumbContainer;
} else {
... ... @@ -85,7 +86,7 @@ function thumbTouchEvt(e) {
//
lazyLoad($curProds.find('.lazy'));
if (isIphone) {
if (isIphone && !isEzinPage) {
if (myScroll) {
myScroll.scrollToElement(scrollToEl, 400);
}
... ... @@ -98,7 +99,7 @@ function thumbTouchEvt(e) {
myScroll && myScroll.refresh();
}
if (isIphone) {
if (isIphone && !isEzinPage) {
if ($('.yoho-header').length > 0) {
$('#wrapper').addClass('ios has-head');
} else {
... ... @@ -116,7 +117,8 @@ $('.info-list .title, .one-good .reco-name').each(function() {
});
//offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
if (parseInt($authorIntro.offset().left, 10) === parseInt($authorIntro.css('margin-left'), 10)) {
if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
parseInt($authorIntro.css('margin-left'), 10))) {
$authorIntro.css('padding-top', 0);
}
... ... @@ -145,18 +147,27 @@ if (hasCollocationBlock) {
$thumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
if (isIphone) {
if (isIphone && !isEzinPage) {
$fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
}
}
/**
* 初始化页面参数
*/
exports.init = function (flag) {
if (flag === true) {
isEzinPage = true;
}
};
// 初始化iscroll
window.onload = function() {
var $scroller = $('#scroller');
var winH, tcH, cbH, cbTop, fixedThumbDom;
if (!isIphone) {
if (!isIphone || isEzinPage) {
return;
}
... ...
... ... @@ -47,7 +47,13 @@ function setLazyLoadAndMellipsis($infos) {
* @params $container 逛资讯列表容器
*/
function initInfosEvt($container) {
var cHammer = new Hammer($container[0]);
var cHammer;
if (typeof $container === 'undefined') {
return;
}
cHammer = new Hammer($container[0]);
cHammer.on('tap', function(e) {
var $this = $(e.target),
... ...