...
|
...
|
@@ -1702,9 +1702,12 @@ var $ = require("jquery"), |
|
|
var start = 0,
|
|
|
swiperClass,
|
|
|
$logotrans = $('.home-header .logo'),
|
|
|
$choseArea = $('.side-nav .first'),
|
|
|
openSideNav = false,
|
|
|
isen = true;
|
|
|
|
|
|
var innerScroll = require("js/plugin/inner-scroll");
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
|
|
|
|
|
$('.nav-btn').on('touchstart', function(event) {
|
...
|
...
|
@@ -1718,6 +1721,8 @@ $('.nav-btn').on('touchstart', function(event) { |
|
|
$sideNav.css('pointer-events', 'auto');
|
|
|
}, 400);
|
|
|
|
|
|
innerScroll.disableScroll($choseArea);
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
|
...
|
...
|
@@ -1732,16 +1737,13 @@ function hideSideBar() { |
|
|
}
|
|
|
|
|
|
$('.overlay').on('touchstart', function(e) {
|
|
|
innerScroll.enableScroll($choseArea);
|
|
|
hideSideBar();
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$sideNav.on('touchmove', function(e) {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
//点击一级导航,弹出二级导航
|
|
|
$sideNav.on('touchstart', 'li', function(e) {
|
|
|
// 点击一级导航,弹出二级导航
|
|
|
$sideNav.on('touchend', 'li', function(e) {
|
|
|
if ($(this).find('.sub-nav').size() > 0) {
|
|
|
$('.sub-nav').removeClass('show');
|
|
|
$(this).find('.sub-nav').addClass('show');
|
...
|
...
|
@@ -1753,7 +1755,7 @@ $sideNav.on('touchstart', 'li', function(e) { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//返回一级导航,收起二级导航
|
|
|
// 返回一级导航,收起二级导航
|
|
|
$subNav.each(function() {
|
|
|
$(this).find('li').eq(0).on('touchend', function() {
|
|
|
$sideNav.css('pointer-events', 'none');
|
...
|
...
|
@@ -1782,7 +1784,7 @@ highlight($sideNav); |
|
|
highlight($subNav);
|
|
|
|
|
|
|
|
|
//头部banner轮播
|
|
|
// 头部banner轮播
|
|
|
if ($('.banner-swiper').find('li').size() > 1) {
|
|
|
bannerSwiper = new Swiper('.banner-swiper', {
|
|
|
lazyLoading: true,
|
...
|
...
|
@@ -1796,7 +1798,7 @@ if ($('.banner-swiper').find('li').size() > 1) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//热门品牌滑动
|
|
|
// 热门品牌滑动
|
|
|
hotBrandsSwiper = new Swiper('.brands-swiper', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
...
|
...
|
@@ -1804,7 +1806,7 @@ hotBrandsSwiper = new Swiper('.brands-swiper', { |
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
//推荐搭配滑动
|
|
|
// 推荐搭配滑动
|
|
|
recommendSwiper = new Swiper('.recommend-swiper', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
...
|
...
|
@@ -1812,7 +1814,7 @@ recommendSwiper = new Swiper('.recommend-swiper', { |
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
//潮品话题轮播
|
|
|
// 潮品话题轮播
|
|
|
if ($('.trend-topic-swiper').find('li').size() > 1) {
|
|
|
trendTopicSwiper = new Swiper('.trend-topic-swiper', {
|
|
|
loop: true,
|
...
|
...
|
@@ -1824,7 +1826,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//潮流上装/经典裤装等轮播
|
|
|
// 潮流上装/经典裤装等轮播
|
|
|
$('.category-swiper').each(function(i, index) {
|
|
|
swiperClass = 'category-swiper' + i;
|
|
|
$(this).addClass(swiperClass);
|
...
|
...
|
@@ -1840,7 +1842,7 @@ $('.category-swiper').each(function(i, index) { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//logo动画
|
|
|
// logo动画
|
|
|
function tsAnimate() {
|
|
|
start = start + 10;
|
|
|
$logotrans.css({
|
...
|
...
|
@@ -1879,7 +1881,7 @@ $('.home-header .iconfont').on('touchstart', function() { |
|
|
// 底部留出tab 的高度
|
|
|
window.reMarginFooter('.footer-tab');
|
|
|
|
|
|
//set cookie
|
|
|
// set cookie
|
|
|
exports.set = function(c) {
|
|
|
window.setCookie('_Channel', c, {
|
|
|
expires: 365,
|
...
|
...
|
@@ -1890,6 +1892,111 @@ exports.set = function(c) { |
|
|
require("js/home/maybe-like")();
|
|
|
|
|
|
});
|
|
|
define("js/plugin/inner-scroll", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 弹出层可以滚动,遮盖层禁止滚动插件
|
|
|
*
|
|
|
* @author liangzhifeng<zhifeng.liang@yoho.cn>
|
|
|
* @date: 2016/02/22
|
|
|
*/
|
|
|
|
|
|
var $ = require("jquery");
|
|
|
|
|
|
function preventDefault(e) {
|
|
|
e = e || window.event;
|
|
|
e.preventDefault && e.preventDefault();
|
|
|
e.returnValue = false;
|
|
|
}
|
|
|
|
|
|
function stopPropagation(e) {
|
|
|
e = e || window.event;
|
|
|
e.stopPropagation && e.stopPropagation();
|
|
|
e.cancelBubble = false;
|
|
|
}
|
|
|
|
|
|
function innerScroll(e) {
|
|
|
var delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
|
|
|
box = $(this).get(0);
|
|
|
|
|
|
// 阻止冒泡到document
|
|
|
// document上已经preventDefault
|
|
|
stopPropagation(e);
|
|
|
|
|
|
|
|
|
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
|
|
|
if (delta < 0) {
|
|
|
preventDefault(e);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if (box.scrollTop === 0) {
|
|
|
if (delta > 0) {
|
|
|
preventDefault(e);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function disableScroll($choseArea) {
|
|
|
var startX, startY;
|
|
|
|
|
|
// 内部可滚
|
|
|
$choseArea.on('mousewheel', innerScroll);
|
|
|
|
|
|
// 移动端touch重写
|
|
|
$choseArea.on('touchstart', function(e) {
|
|
|
startX = e.originalEvent.changedTouches[0].pageX;
|
|
|
startY = e.originalEvent.changedTouches[0].pageY;
|
|
|
});
|
|
|
|
|
|
// 仿innerScroll方法
|
|
|
$choseArea.on('touchmove', function(e) {
|
|
|
var deltaX = e.originalEvent.changedTouches[0].pageX - startX,
|
|
|
deltaY = e.originalEvent.changedTouches[0].pageY - startY;
|
|
|
|
|
|
var box = $(this).get(0);
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
|
// 只能纵向滚
|
|
|
if (Math.abs(deltaY) < Math.abs(deltaX)) {
|
|
|
e.preventDefault();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
|
|
|
if (deltaY < 0) {
|
|
|
e.preventDefault();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if (box.scrollTop === 0) {
|
|
|
if (deltaY > 0) {
|
|
|
e.preventDefault();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$(document).on('mousewheel', preventDefault);
|
|
|
$(document).on('touchmove', preventDefault);
|
|
|
}
|
|
|
|
|
|
function enableScroll($choseArea) {
|
|
|
|
|
|
$choseArea.off('touchstart');
|
|
|
$choseArea.off('touchmove');
|
|
|
$choseArea.off('mousewheel');
|
|
|
|
|
|
$(document).off('mousewheel', preventDefault);
|
|
|
$(document).off('touchmove', preventDefault);
|
|
|
}
|
|
|
|
|
|
exports.enableScroll = enableScroll;
|
|
|
exports.disableScroll = disableScroll;
|
|
|
});
|
|
|
define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){
|
|
|
/**
|
|
|
* “你可能喜欢”模块JS
|
...
|
...
|
@@ -3564,10 +3671,10 @@ function getInstance() { |
|
|
'{{# hasFooter}}' +
|
|
|
'<div class="dialog-footer">' +
|
|
|
'{{# leftBtnText}}' +
|
|
|
'<span class="dialog-left-btn">{{.}}</span>' +
|
|
|
'<span class="dialog-left-btn tap-hightlight">{{.}}</span>' +
|
|
|
'{{/ leftBtnText}}' +
|
|
|
'{{# rightBtnText}}' +
|
|
|
'<span class="dialog-right-btn">{{.}}</span>' +
|
|
|
'<span class="dialog-right-btn tap-hightlight">{{.}}</span>' +
|
|
|
'{{/ rightBtnText}}' +
|
|
|
'</div>' +
|
|
|
'{{/ hasFooter}}' +
|
...
|
...
|
@@ -5438,6 +5545,8 @@ var $ = require("jquery"), |
|
|
tip = require("js/plugin/tip"),
|
|
|
loading = require("js/plugin/loading");
|
|
|
|
|
|
var innerScroll = require("js/plugin/inner-scroll");
|
|
|
|
|
|
var $chosePanel = $('#chose-panel'),
|
|
|
$num,
|
|
|
$chosed,
|
...
|
...
|
@@ -5456,6 +5565,7 @@ var $chosePanel = $('#chose-panel'), |
|
|
cbFn,
|
|
|
$allChoseItems,
|
|
|
queryString,
|
|
|
$choseArea,
|
|
|
$soonSoldOut = $('.soonSoldOut-tag'),
|
|
|
$yohoPage = $('.yoho-page');
|
|
|
|
...
|
...
|
@@ -5471,6 +5581,7 @@ function init() { |
|
|
$curSizeBlock = null;
|
|
|
queryString = $.queryString();
|
|
|
$imgsThumb = $('.chose-panel').find('.thumb');
|
|
|
$choseArea = $('.chose-panel .main .chose-items');
|
|
|
$allChoseItems = $('.chose-items');
|
|
|
$sizeRowList = $('.size-list ul');
|
|
|
$colorRowList = $('.color-list ul');
|
...
|
...
|
@@ -5537,20 +5648,6 @@ function disableNumEdit() { |
|
|
|
|
|
|
|
|
function show(html, cb) {
|
|
|
var $html = $('html, body');
|
|
|
|
|
|
/*var scrollPosition = [
|
|
|
document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
|
document.documentElement.scrollTop || document.body.scrollTop
|
|
|
],
|
|
|
$html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that
|
|
|
|
|
|
$html.data('scroll-position', scrollPosition);
|
|
|
$html.data('previous-overflow', $html.css('overflow'));
|
|
|
$html.css('overflow', 'hidden');
|
|
|
$html.css('height', '100%');
|
|
|
window.scrollTo(scrollPosition[0], scrollPosition[1]);*/
|
|
|
|
|
|
if (html) {
|
|
|
$chosePanel.html(html);
|
|
|
if ($('#promotionId').val() !== '') {
|
...
|
...
|
@@ -5558,23 +5655,19 @@ function show(html, cb) { |
|
|
}
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
$('.chose-panel').show();
|
|
|
$num = $('#good-num');
|
|
|
cbFn = cb;
|
|
|
|
|
|
|
|
|
innerScroll.disableScroll($choseArea);
|
|
|
}
|
|
|
|
|
|
//隐藏当前Panel
|
|
|
function hide() {
|
|
|
$html = $('html, body');
|
|
|
|
|
|
/*var $html = $('html, body'),
|
|
|
scrollPosition = $html.data('scroll-position');
|
|
|
|
|
|
// un-lock scroll position
|
|
|
$html.css('overflow', $html.data('previous-overflow'));
|
|
|
$html.css('height', 'auto');
|
|
|
window.scrollTo(scrollPosition[0], scrollPosition[1]);*/
|
|
|
$('.chose-panel').hide();
|
|
|
innerScroll.enableScroll($choseArea);
|
|
|
}
|
|
|
|
|
|
//修改加入购物车的文字和背景
|
...
|
...
|
@@ -5656,6 +5749,7 @@ function changeColorChosed(newColorIndex) { |
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
$yohoPage.on('touchstart', '.chose-panel', function(e) {
|
|
|
var $cur = $(e.target);
|
|
|
|
...
|
...
|
@@ -5666,6 +5760,8 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) { |
|
|
//点击蒙版消失
|
|
|
hide();
|
|
|
|
|
|
enableScroll();
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
|
...
|
...
|
@@ -9574,7 +9670,7 @@ $('.down').on('touchend', function() { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, exports, module){
|
|
|
define("js/cart/gift-advance", ["jquery","mlellipsis","lazyload","hammer"], function(require, exports, module){
|
|
|
/**
|
|
|
* 赠品/加价购
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -9582,6 +9678,7 @@ define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, |
|
|
*/
|
|
|
|
|
|
var $ = require("jquery"),
|
|
|
ellipsis = require("mlellipsis"),
|
|
|
lazyLoad = require("lazyload"),
|
|
|
Hammer = require("hammer"),
|
|
|
tip = require("js/plugin/tip"),
|
...
|
...
|
@@ -9594,6 +9691,7 @@ var $page = $('.gift-advance-page'), |
|
|
require("js/common");
|
|
|
|
|
|
lazyLoad($('.lazy'));
|
|
|
ellipsis.init();
|
|
|
|
|
|
function getProductInfo(skn, promotionId) {
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -9627,13 +9725,11 @@ $page.find('.chose').each(function(i, elem) { |
|
|
});
|
|
|
});
|
|
|
|
|
|
// $page.on('touchend', '.chose', function() {
|
|
|
// var $this = $(this),
|
|
|
// id = $this.closest('.gift-advance-good').data('id'),
|
|
|
// promotionId = $this.closest('.advance-block').data('promotion-id');
|
|
|
//
|
|
|
// getProductInfo(id, promotionId);
|
|
|
// });
|
|
|
setTimeout(function() {
|
|
|
$('.gift-advance-good .name').each(function() {
|
|
|
this.mlellipsis(2);
|
|
|
});
|
|
|
}, 0);
|
|
|
|
|
|
});
|
|
|
define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){
|
...
|
...
|
|