Skip to content

Commit e94747a

Browse files
authored
gppt-disable-auto-height: Added new to disable Swiper auto height.
1 parent 0b860f2 commit e94747a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Page Transitions // Disable Auto Height
4+
* https://gravitywiz.com/documentation/gravity-forms-page-transitions/
5+
*
6+
* This snippet disables Swiper's auto height and forces all slides to match the height of the tallest slide.
7+
*/
8+
// Update "123" to your form ID
9+
$target_form_id = 123;
10+
11+
add_filter( "gppt_script_args_{$target_form_id}", function( $args, $form ) {
12+
$args['transitionSettings']['autoHeight'] = false;
13+
return $args;
14+
}, 10, 2 );
15+
16+
add_filter( "gform_pre_render_{$target_form_id}", function( $form ) {
17+
add_action( 'wp_head', 'disable_auto_height_styles' );
18+
return $form;
19+
});
20+
21+
add_action( 'gform_preview_footer', function( $form_id ) use ( $target_form_id ) {
22+
if ( $form_id == $target_form_id ) {
23+
disable_auto_height_styles();
24+
}
25+
});
26+
27+
function disable_auto_height_styles() {
28+
?>
29+
<style>
30+
.gppt-has-page-transitions .swiper-slide {
31+
height: auto;
32+
align-self: stretch;
33+
}
34+
</style>
35+
<?php
36+
}

0 commit comments

Comments
 (0)