Skip to content

Commit 4bbbae3

Browse files
authored
Merge pull request alvarotrigo#2443 from publicJorn/dev
Prevent keypresses to fire prematurely
2 parents 221441a + b690f01 commit 4bbbae3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

jquery.fullPage.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
}, options);
187187

188188
//flag to avoid very fast sliding for landscape sliders
189-
var slideMoving = false;
189+
var slideMoving = false;
190190

191191
var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
192192
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints));
@@ -228,7 +228,7 @@
228228
* It changes the scroll bar visibility and the history of the site as a result.
229229
*/
230230
function setAutoScrolling(value, type){
231-
//removing the transformation
231+
//removing the transformation
232232
if(!value){
233233
silentScroll(0);
234234
}
@@ -1747,6 +1747,11 @@
17471747
e.preventDefault();
17481748
}
17491749

1750+
//do nothing if we can not scroll or we are not using horizotnal key arrows.
1751+
if(!canScroll && [37,39].indexOf(e.which) < 0){
1752+
return;
1753+
}
1754+
17501755
controlPressed = e.ctrlKey;
17511756

17521757
keydownId = setTimeout(function(){
@@ -2636,7 +2641,7 @@
26362641
// The first section can have a negative value in iOS 10. Not quite sure why: -0.0142822265625
26372642
// that's why we round it to 0.
26382643
var roundedTop = Math.round(top);
2639-
2644+
26402645
if (options.css3 && options.autoScrolling && !options.scrollBar){
26412646
var translate3d = 'translate3d(0px, -' + roundedTop + 'px, 0px)';
26422647
transformContainer(translate3d, false);

0 commit comments

Comments
 (0)