Skip to content

Commit d1fe010

Browse files
committed
- Fixed bug: iScroll on page load scrolling not working alvarotrigo#2353
1 parent c57b7dc commit d1fe010

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

jquery.fullPage.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,16 +2901,29 @@
29012901
refreshId: null,
29022902
iScrollInstances: [],
29032903

2904+
// Enables or disables the mouse wheel for the active section or all slides in it
2905+
toggleWheel: function(value){
2906+
var scrollable = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL);
2907+
scrollable.each(function(){
2908+
var iScrollInstance = $(this).data('iscrollInstance');
2909+
if(typeof iScrollInstance !== 'undefined' && iScrollInstance){
2910+
if(value){
2911+
iScrollInstance.wheelOn();
2912+
}
2913+
else{
2914+
iScrollInstance.wheelOff();
2915+
}
2916+
}
2917+
});
2918+
},
2919+
29042920
/**
29052921
* Turns off iScroll for the destination section.
29062922
* When scrolling very fast on some trackpads (and Apple laptops) the inertial scrolling would
29072923
* scroll the destination section/slide before the sections animations ends.
29082924
*/
29092925
onLeave: function(){
2910-
var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance');
2911-
if(typeof scroller !== 'undefined' && scroller){
2912-
scroller.wheelOff();
2913-
}
2926+
iscrollHandler.toggleWheel(false);
29142927
},
29152928

29162929
// Turns off iScroll for the leaving section
@@ -2920,10 +2933,7 @@
29202933

29212934
// Turns on iScroll on section load
29222935
afterLoad: function(){
2923-
var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance');
2924-
if(typeof scroller !== 'undefined' && scroller){
2925-
scroller.wheelOn();
2926-
}
2936+
iscrollHandler.toggleWheel(true);
29272937
},
29282938

29292939
/**

0 commit comments

Comments
 (0)