...
|
...
|
@@ -77,13 +77,13 @@ function preventDefault(e) { |
|
|
e.returnValue = false;
|
|
|
}
|
|
|
|
|
|
function stopPropagation(e){
|
|
|
function stopPropagation(e) {
|
|
|
e = e || window.event;
|
|
|
e.stopPropagation && e.stopPropagation();
|
|
|
e.cancelBubble = false;
|
|
|
}
|
|
|
|
|
|
function innerScroll(e){
|
|
|
function innerScroll(e) {
|
|
|
var delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
|
|
|
box = $(this).get(0);
|
|
|
|
...
|
...
|
@@ -92,20 +92,18 @@ function innerScroll(e){ |
|
|
stopPropagation(e);
|
|
|
|
|
|
|
|
|
if($(box).height() + box.scrollTop >= box.scrollHeight){
|
|
|
if(delta < 0) {
|
|
|
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
|
|
|
if (delta < 0) {
|
|
|
preventDefault(e);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if(box.scrollTop === 0){
|
|
|
if(delta > 0) {
|
|
|
if (box.scrollTop === 0) {
|
|
|
if (delta > 0) {
|
|
|
preventDefault(e);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
// 会阻止原生滚动
|
|
|
// return false;
|
|
|
}
|
|
|
|
|
|
function disableScroll() {
|
...
|
...
|
@@ -124,10 +122,13 @@ function disableScroll() { |
|
|
|
|
|
// 仿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();
|
|
|
|
|
|
var deltaX = e.originalEvent.changedTouches[0].pageX - startX;
|
|
|
var deltaY = e.originalEvent.changedTouches[0].pageY - startY;
|
|
|
|
|
|
// 只能纵向滚
|
|
|
if (Math.abs(deltaY) < Math.abs(deltaX)) {
|
...
|
...
|
@@ -135,7 +136,6 @@ function disableScroll() { |
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var box = $(this).get(0);
|
|
|
|
|
|
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
|
|
|
if (deltaY < 0) {
|
...
|
...
|
|