Skip to content

Commit f6777b8

Browse files
committed
Prevent keypresses to fire prematurely
1 parent 914c1a3 commit f6777b8

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,8 @@
186186
}, options);
187187

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

191192
var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
192193
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints));
@@ -228,7 +229,7 @@
228229
* It changes the scroll bar visibility and the history of the site as a result.
229230
*/
230231
function setAutoScrolling(value, type){
231-
//removing the transformation
232+
//removing the transformation
232233
if(!value){
233234
silentScroll(0);
234235
}
@@ -1450,6 +1451,7 @@
14501451
* Performs the vertical movement (by CSS3 or by jQuery)
14511452
*/
14521453
function performMovement(v){
1454+
sectionMoving = true;
14531455
// using CSS3 translate functionality
14541456
if (options.css3 && options.autoScrolling && !options.scrollBar) {
14551457

@@ -1571,6 +1573,7 @@
15711573
*/
15721574
function afterSectionLoads (v){
15731575
continuousVerticalFixSectionOrder(v);
1576+
sectionMoving = false;
15741577

15751578
//callback (afterLoad) if the site is not just resizing and readjusting the slides
15761579
$.isFunction(options.afterLoad) && !v.localIsResizing && options.afterLoad.call(v.element, v.anchorLink, (v.sectionIndex + 1));
@@ -1747,6 +1750,8 @@
17471750
e.preventDefault();
17481751
}
17491752

1753+
if (sectionMoving) return;
1754+
17501755
controlPressed = e.ctrlKey;
17511756

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

0 commit comments

Comments
 (0)