Authored by 梁志锋

gulp ge文件提交

... ... @@ -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
... ... @@ -5760,8 +5656,6 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) {
//点击蒙版消失
hide();
enableScroll();
return false;
});
... ... @@ -6039,6 +5933,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){
/**
* 商品详情 --异步加载页面下半部分
... ... @@ -8270,7 +8269,8 @@ define("js/me/index", ["jquery","swiper","index"], function(require, exports, mo
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/12
*/
var $ = require("jquery");
var $ = require("jquery"),
noticeScroll = require("js/plugin/notice-scroll");
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item');
var myImage = new Image(),
... ... @@ -8286,6 +8286,8 @@ myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
noticeScroll('.notice');
$('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() {
$listItem.removeClass('highlight');
$(this).addClass('highlight');
... ... @@ -8294,6 +8296,38 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio
});
});
define("js/plugin/notice-scroll", ["jquery"], function(require, exports, module){
/**
* 公告栏目滚动
* bikai kai.bi@yoho.cn
*/
var $ = require("jquery");
function noticeScroll(selecter, time) {
var $notice = $(selecter),
$noticeItem = $notice.find('.notice-item'),
count = $noticeItem.length,
i = 1;
selecter = selecter || '.notice';
time = time || 3000;
if (count > 1) {
setInterval(function() {
if (i >= count) {
i = 0;
}
$noticeItem.fadeOut();
$notice.find('.item-' + i).fadeIn();
i++;
}, time);
}
}
module.exports = noticeScroll;
});
define("js/product/recommend-for-you", ["swiper","jquery","index"], function(require, exports, module){
/**
* 为您优选
... ... @@ -9344,6 +9378,10 @@ $('.btn-balance').on('touchend', function() {
}
});
$('.off-shell-goods .shopping-cart-good').on('touchend', function() {
tip.show('商品已下架');
});
$('.chose').on('touchend', function() {
chosePanel.show();
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.