Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active September 18, 2024 05:55
Show Gist options
  • Save wpmudev-sls/e6c5975df8cedab1a56788c6aa7066b8 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/e6c5975df8cedab1a56788c6aa7066b8 to your computer and use it in GitHub Desktop.
[Forminator Pro] - Form pagination scroll issue in the elementor popup
<?php
/**
* Plugin Name: [Forminator Pro] Pagination scroll fix in elemntor popup
* Description: Fix form not scrolling to top inside Elementor popup in Mobile on next button.
* Author: Prashant @ WPMUDEV
* Task: SLS-6492
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_action( 'wp_footer', 'wpmudev_elementor_form_scroll_paginate_fix', 9999 );
function wpmudev_elementor_form_scroll_paginate_fix() {
if ( ! is_page( 'cpc40120-popup-form' ) ) { // Please change the page slug accordingly.
return;
}
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$( document ).on( 'forminator.front.pagination.move', function( e ) {
var scrolltop = $(document).find('.forminator-pagination--content').offset().top;
$(document).find('.elementor-popup-modal .dialog-message').animate({ scrollTop: scrolltop + 10 }, 500);
});
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment