...
|
...
|
@@ -71,6 +71,32 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) { |
|
|
isSelected = isThisGoodSelected;
|
|
|
}
|
|
|
|
|
|
function preventDefault(e) {
|
|
|
console.log(e);
|
|
|
if (e.target.localName === 'ul') return;
|
|
|
e = e || window.event;
|
|
|
if (e.preventDefault)
|
|
|
e.preventDefault();
|
|
|
e.returnValue = false;
|
|
|
}
|
|
|
|
|
|
function disableScroll(e) {
|
|
|
if (window.addEventListener) // older FF
|
|
|
window.addEventListener('DOMMouseScroll', preventDefault, false);
|
|
|
window.onwheel = preventDefault; // modern standard
|
|
|
window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
|
|
|
window.ontouchmove = preventDefault; // mobile
|
|
|
}
|
|
|
|
|
|
function enableScroll() {
|
|
|
if (window.removeEventListener)
|
|
|
window.removeEventListener('DOMMouseScroll', preventDefault, false);
|
|
|
window.onmousewheel = document.onmousewheel = null;
|
|
|
window.onwheel = null;
|
|
|
window.ontouchmove = null;
|
|
|
document.onkeydown = null;
|
|
|
}
|
|
|
|
|
|
//删除面板
|
|
|
function removePannel() {
|
|
|
var $pannel = $('.chose-panel'),
|
...
|
...
|
@@ -112,9 +138,7 @@ function disableNumEdit() { |
|
|
|
|
|
|
|
|
function show(html, cb) {
|
|
|
var $html = $('html, body');
|
|
|
|
|
|
/*var scrollPosition = [
|
|
|
var scrollPosition = [
|
|
|
document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
|
document.documentElement.scrollTop || document.body.scrollTop
|
|
|
],
|
...
|
...
|
@@ -124,7 +148,7 @@ function show(html, cb) { |
|
|
$html.data('previous-overflow', $html.css('overflow'));
|
|
|
$html.css('overflow', 'hidden');
|
|
|
$html.css('height', '100%');
|
|
|
window.scrollTo(scrollPosition[0], scrollPosition[1]);*/
|
|
|
window.scrollTo(scrollPosition[0], scrollPosition[1]);
|
|
|
|
|
|
if (html) {
|
|
|
$chosePanel.html(html);
|
...
|
...
|
@@ -136,20 +160,22 @@ function show(html, cb) { |
|
|
$('.chose-panel').show();
|
|
|
$num = $('#good-num');
|
|
|
cbFn = cb;
|
|
|
|
|
|
disableScroll();
|
|
|
}
|
|
|
|
|
|
//隐藏当前Panel
|
|
|
function hide() {
|
|
|
$html = $('html, body');
|
|
|
|
|
|
/*var $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]);*/
|
|
|
window.scrollTo(scrollPosition[0], scrollPosition[1]);
|
|
|
$('.chose-panel').hide();
|
|
|
|
|
|
enableScroll();
|
|
|
}
|
|
|
|
|
|
//修改加入购物车的文字和背景
|
...
|
...
|
@@ -231,6 +257,7 @@ function changeColorChosed(newColorIndex) { |
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
$yohoPage.on('touchstart', '.chose-panel', function(e) {
|
|
|
var $cur = $(e.target);
|
|
|
|
...
|
...
|
@@ -241,6 +268,8 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) { |
|
|
//点击蒙版消失
|
|
|
hide();
|
|
|
|
|
|
enableScroll();
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
|
...
|
...
|
|