Skip to content

Commit 07fdbe3

Browse files
gppt-scroll-to-top.js: Updated to work with latest behavior that scrolls to the top of the form.
1 parent 55ee2d3 commit 07fdbe3

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
/**
2-
* Gravity Perks // Page Transitions // Scroll to Top for Long Pages
2+
* Gravity Perks // Page Transitions // Scroll to top of page instead of top of form
33
* https://gravitywiz.com/documentation/gravity-forms-page-transitions/
4+
*
5+
* If using Gravity Forms Custom Javascript, you will also need to install
6+
* the follow snippet: https://github.com/gravitywiz/snippet-library/blob/master/experimental/gfjs-early-init-scripts.php
47
*/
5-
gform.addAction( 'gppt_before_transition', function() {
6-
window.scroll( {
7-
top: 0,
8-
left: 0,
9-
behavior: 'smooth'
10-
} );
11-
} );
8+
gform.addFilter('gppt_swiper_options', function (options) {
9+
options.on.slideChange = function () {
10+
window.scroll({
11+
top: 0,
12+
left: 0,
13+
behavior: 'smooth'
14+
});
15+
}
16+
17+
return options;
18+
});

0 commit comments

Comments
 (0)