Authored by 郭成尧

'shop-id-no-domain'

... ... @@ -17,7 +17,8 @@ var bannerSwiper,
main2oH,
scH,
$nav1 = $('#pos-nav'),
$nav2 = $('#pos-list');
$nav2 = $('#pos-list'),
sTop;
var tip = require('../../plugin/tip'),
filter = require('../../plugin/filter'),
... ... @@ -39,6 +40,7 @@ var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
require('../../common');
// 默认筛选条件
var defaultOpt = require('../../common/query-param');
... ... @@ -163,7 +165,7 @@ function getPageGoods(info) {
info.callBack(data);
},
error: function() {
alert('网络断开连接了~');
tip.show('网络断开连接了~');
searching = false;
}
});
... ... @@ -237,11 +239,7 @@ function tabChange(dom, index) {
}
myScroll = new IScroll('#wrapper', {
probeType: 3,
mouseWheel: true,
click: true
});
// 首页导航
(function(nav, posNav, main) {
... ... @@ -324,7 +322,8 @@ function reNav1Pos() {
}
}
myScroll.on('scroll', function() {
function scrollHandler() {
var scrollCall,
sTop = -this.y;
... ... @@ -433,26 +432,7 @@ myScroll.on('scroll', function() {
});
}
}
});
myScroll.on('scrollStart', function() {
// stop auto play when scroll
bannerSwiper && bannerSwiper.stopAutoplay();
multiSwiper && multiSwiper.stopAutoplay();
});
myScroll.on('scrollEnd', function() {
// start auto play when scroll end
bannerSwiper && bannerSwiper.startAutoplay();
multiSwiper && multiSwiper.startAutoplay();
$('#scroller').trigger('scroll');
});
}
document.addEventListener('touchmove', function(e) {
// sub classify不阻止默认事件
... ... @@ -463,21 +443,54 @@ document.addEventListener('touchmove', function(e) {
/* if (!isIphone) {
return;
}*/
}*/
// window onload 后重新refresh iscroll
$(window).load(function() {
myScroll && myScroll.refresh();
// window ready 后重新refresh iscroll
$(window).ready(function() {
// myScroll && myScroll.refresh();
imgH = $('#nav-top').outerHeight();
nav1H = $('#nav').outerHeight();
main1H = $('#nav-main').height();
main1oH = $('#nav-main').outerHeight();
nav2H = $('#list-nav').outerHeight();
main2oH = $('#goods-container').outerHeight();
setTimeout(function() {
myScroll = new IScroll('#wrapper', {
probeType: 2,
mouseWheel: false,
click: true
});
// setTimeout(function() {
scH = $('#scroller').outerHeight();
}, 1000);
// }, 1000);
myScroll.on('scroll', function() {
window.requestAnimationFrame(scrollHandler);
});
myScroll.on('scrollStart', function() {
// stop auto play when scroll
bannerSwiper && bannerSwiper.stopAutoplay();
multiSwiper && multiSwiper.stopAutoplay();
});
myScroll.on('scrollEnd', function() {
// start auto play when scroll end
bannerSwiper && bannerSwiper.startAutoplay();
multiSwiper && multiSwiper.startAutoplay();
$('#scroller').trigger('scroll');
});
});
function bindGoodThumbClick() {
... ... @@ -647,7 +660,10 @@ function search(opt) {
window.rePosFooter();
myScroll.refresh();
setTimeout(function() {
myScroll && myScroll.refresh();
}, 0);
reNav1Pos();
bindGoodThumbClick();
... ... @@ -690,14 +706,14 @@ $subNav.on('touchend touchcancel', function(e) {
$pre.addClass('active');
$this.removeClass('active');
myScroll.enable();
myScroll && myScroll.enable();
} else {
$pre = $this.siblings('.active');
$pre.removeClass('active');
$this.addClass('active');
myScroll.scrollTo(0, -(imgH + main1oH + nav1H));
myScroll && myScroll.scrollTo(0, -(imgH + main1oH + nav1H));
theY = imgH + main1oH + nav1H;
... ... @@ -711,7 +727,7 @@ $subNav.on('touchend touchcancel', function(e) {
$('.filter-mask').removeClass('call-by-fix').css('top', $this.offset().top + nav1H);
}
myScroll.disable();
myScroll && myScroll.disable();
}
} else {
if ($this.hasClass('new')) {
... ... @@ -725,7 +741,7 @@ $subNav.on('touchend touchcancel', function(e) {
navType = 'discount';
}
myScroll.enable();
myScroll && myScroll.enable();
nav = navInfo[navType];
... ... @@ -904,18 +920,13 @@ $collect.on('touchstart', function() {
}
if (data.code === 401) {
url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href) + '&openby:yohobuy=';
url += JSON.stringify({'action': 'go.weblogin',
'params': {
'jumpurl': {'url': 'http://m.yohobuy.com' + location.pathname, 'param': info.data},
'requesturl': {'param': {}, 'url': ''},
'priority': 'N'
// url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href) + '&openby:yohobuy=';
// url += JSON.stringify({"action": "go.weblogin", "params": { "jumpurl": { "url": 'http://m.yohobuy.com' + location.pathname, "param": info.data }, "requesturl": { "param": {}, "url": "" }, "priority": "N" } });
url = data.url;
if ($('#jump-login').length <= 0) {
$('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
}
});
$('body').append('<a href=\'' + url + '\'><span class="jump-login"><span></a>');
$('.jump-login').click();
$('#jump-login').click();
}
setTimeout(function() {
... ...