Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
mousewheel: prevent page scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1253 committed Sep 16, 2015
1 parent c6a1b4b commit 0eaf4fa
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
9 changes: 8 additions & 1 deletion dist/coverflow.js
Expand Up @@ -2936,6 +2936,11 @@ $.extend( $.coverflow.renderer, {
mousewheel: debounce(me._onMouseWheel, 200),
DOMMouseScroll: debounce(me._onMouseWheel, 200)
});

me._on({
mousewheel: me._preventPageScroll,
DOMMouseScroll: me._preventPageScroll
});
}

if( o.trigger.swipe ) {
Expand Down Expand Up @@ -3287,10 +3292,12 @@ $.extend( $.coverflow.renderer, {
index: index != null ? index : this.currentIndex
};
},
_preventPageScroll : function(ev) {
ev.preventDefault();
},
_onMouseWheel : function ( ev ) {
var origEv = ev.originalEvent;

ev.preventDefault();
if( origEv.wheelDelta > 0 || origEv.detail < 0 ) {
this.prev();
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/coverflow.min.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion dist/coverflow.standalone.js
Expand Up @@ -829,6 +829,11 @@ $.extend( $.coverflow.renderer, {
mousewheel: debounce(me._onMouseWheel, 200),
DOMMouseScroll: debounce(me._onMouseWheel, 200)
});

me._on({
mousewheel: me._preventPageScroll,
DOMMouseScroll: me._preventPageScroll
});
}

if( o.trigger.swipe ) {
Expand Down Expand Up @@ -1180,10 +1185,12 @@ $.extend( $.coverflow.renderer, {
index: index != null ? index : this.currentIndex
};
},
_preventPageScroll : function(ev) {
ev.preventDefault();
},
_onMouseWheel : function ( ev ) {
var origEv = ev.originalEvent;

ev.preventDefault();
if( origEv.wheelDelta > 0 || origEv.detail < 0 ) {
this.prev();
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/coverflow.standalone.min.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/js/coverflow.js
Expand Up @@ -222,6 +222,11 @@
mousewheel: debounce(me._onMouseWheel, 200),
DOMMouseScroll: debounce(me._onMouseWheel, 200)
});

me._on({
mousewheel: me._preventPageScroll,
DOMMouseScroll: me._preventPageScroll
});
}

if( o.trigger.swipe ) {
Expand Down Expand Up @@ -573,10 +578,12 @@
index: index != null ? index : this.currentIndex
};
},
_preventPageScroll : function(ev) {
ev.preventDefault();
},
_onMouseWheel : function ( ev ) {
var origEv = ev.originalEvent;

ev.preventDefault();
if( origEv.wheelDelta > 0 || origEv.detail < 0 ) {
this.prev();
return;
Expand Down
6 changes: 6 additions & 0 deletions tests/visual_3d.html
Expand Up @@ -11,6 +11,12 @@
<link type="text/css" href="../src/css/coverflow.css" rel="stylesheet" />
<link type="text/css" href="../libs/jquery-ui/themes/base/jquery.ui.core.css" rel="stylesheet" />

<style type="text/css">
html,
body {
min-height: 200%;
}
</style>
</head>
<body>

Expand Down

0 comments on commit 0eaf4fa

Please sign in to comment.