Created
May 17, 2023 10:17
-
-
Save adczk/81bf22bafd856e81d7d4fefae3e64429 to your computer and use it in GitHub Desktop.
Forminator - fix scroll issue for Guten Modal Block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: [Forminator Pro] - Fix Scroll Issue for forms inside Guten Modal Block plugin modal | |
| * Description: [Forminator Pro] - Fix Scroll Issue | |
| * Author: adczk based on Prashant Singh's solution for mobiles | |
| * Author URI: https://premium.wpmudev.org | |
| * License: GPLv2 or later | |
| * | |
| * USE A MU PLUGIN | |
| * | |
| * FORM MUST BE SET TO LOAD USING AJAX (otherwise this solution doesn't work) | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { exit; } elseif ( defined( 'WP_CLI' ) && WP_CLI ) { return; } | |
| add_action( 'wp_footer', function(){ | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery(document).ready(function ($) { | |
| $(document).on("after.load.forminator", function (e, id) { | |
| $(document).on('click', '.forminator-pagination-footer .forminator-button', function(e){ | |
| var wpmu_scroll_top = $(window).scrollTop(); | |
| if (wpmu_scroll_top>0){ | |
| $("html,body").stop(); | |
| } | |
| }); | |
| }); | |
| }); | |
| </script> | |
| <?php | |
| },9999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment