Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/beta/wap' into develop/wap

... ... @@ -1702,15 +1702,12 @@ var $ = require("jquery"),
var start = 0,
swiperClass,
$logotrans = $('.home-header .logo'),
$choseArea = $('.side-nav ul'),
openSideNav = false,
isen = true;
var innerScroll = require("js/plugin/inner-scroll");
lazyLoad($('img.lazy'));
$('.nav-btn').on('touchstart', function(event) {
$('.nav-btn').on('touchstart', function() {
$sideNav.css('pointer-events', 'none');
$mobileWrap.addClass('menu-open');
$overlay.show().css('opacity', 0.3);
... ... @@ -1721,7 +1718,7 @@ $('.nav-btn').on('touchstart', function(event) {
$sideNav.css('pointer-events', 'auto');
}, 400);
innerScroll.disableScroll($choseArea);
//innerScroll.disableScroll($sideNav);
return false;
});
... ... @@ -1737,16 +1734,20 @@ function hideSideBar() {
}
$('.overlay').on('touchstart', function(e) {
innerScroll.enableScroll($choseArea);
hideSideBar();
return false;
});
$sideNav.on('touchmove', function(e) {
return false;
});
// 点击一级导航,弹出二级导航
$sideNav.on('touchend', 'li', function(e) {
if ($(this).find('.sub-nav').size() > 0) {
$('.sub-nav').removeClass('show');
$(this).find('.sub-nav').addClass('show');
$(this).find('.highlight').removeClass('highlight');
}
if (e.target.pathname === location.pathname) {
... ... @@ -1892,111 +1893,6 @@ 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
... ... @@ -5516,6 +5412,7 @@ $('#likeBtn').on('touchstart', function() {
});
$('#addtoCart').on('touchstart', function() {
$('.cart-bar').hide();
chosePanel.show();
//统计代码:用于统计用户加入购物车的动作
... ... @@ -5566,6 +5463,7 @@ var $chosePanel = $('#chose-panel'),
$allChoseItems,
queryString,
$choseArea,
$cartBar,
$soonSoldOut = $('.soonSoldOut-tag'),
$yohoPage = $('.yoho-page');
... ... @@ -5586,6 +5484,7 @@ function init() {
$sizeRowList = $('.size-list ul');
$colorRowList = $('.color-list ul');
$leftNum = $('#left-num');
$cartBar = $('.cart-bar');
curColorIndex = 0;
curSizeIndex = 0;
isEdit = 0;
... ... @@ -5668,6 +5567,10 @@ function show(html, cb) {
function hide() {
$('.chose-panel').hide();
innerScroll.enableScroll($choseArea);
if ($cartBar.length > 0) {
$cartBar.show();
}
}
//修改加入购物车的文字和背景
... ... @@ -5760,8 +5663,6 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) {
//点击蒙版消失
hide();
enableScroll();
return false;
});
... ... @@ -6039,6 +5940,111 @@ exports.disableNumEdit = disableNumEdit;
});
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/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){
/**
* 商品详情 --异步加载页面下半部分
... ... @@ -8617,6 +8623,13 @@ $page.on('touchstart', '.del-icon', function() {
});
});
});
$('.deps').on('touchstart', 'span', function() {
$(this).css('background', '#eee');
}).on('touchend touchcancel', 'span', function() {
$(this).css('background', 'transparent');
});
});
define("js/me/address-act", ["jquery","hammer"], function(require, exports, module){
/**
... ... @@ -9344,6 +9357,10 @@ $('.btn-balance').on('touchend', function() {
}
});
$('.off-shell-goods').on('touchstart touchend', function() {
return false;
});
$('.chose').on('touchend', function() {
chosePanel.show();
});
... ... @@ -9488,6 +9505,11 @@ $('.icon-edit').on('touchstart', function(e) {
count,
canEditNum;
if ($this.parents('.off-shell-goods').length) {
tip.show('商品已下架');
return false;
}
//如果点击的是上次编辑的商品,直接显示chose-pannel
if (skn === previousEditSkn) {
chosePanel.show();
... ... @@ -9533,6 +9555,11 @@ $('.icon-edit').on('touchstart', function(e) {
$('.icon-del').on('touchstart', function(e) {
var $this = $(this);
if ($this.parents('.off-shell-goods').length) {
tip.show('商品已下架');
return false;
}
e.stopPropagation();
dialog.showDialog({
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -217,6 +217,7 @@ $('.btn-balance').on('touchend', function() {
});
$('.off-shell-goods').on('touchstart touchend', function() {
tip.show('商品已下架');
return false;
});
... ...
... ... @@ -19,7 +19,6 @@ var $ = require('jquery'),
var start = 0,
swiperClass,
$logotrans = $('.home-header .logo'),
$choseArea = $('.side-nav ul'),
openSideNav = false,
isen = true;
... ...