Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1203719

    Hi Support,
    I am wanting to move the “message sent” message you get when a form is sent in. What happens now is, when the user submits the form, the “message has been sent” message is above the fold so the user cannot readily see it. I have one customer that wants it to be readily visible. Here is a screenshot of what I am looking for below.
    I would like the ability to dial in the placement on the page.
    Thank You,
    Keith

    #1205280

    Hey Keith,
    Sorry for the late reply, I see that you wanted the message div to move down, but how about scrolling the page up on submit?
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $("#top.page-id-1167 input.button").click(function() {
      $("html, body").animate({ scrollTop: 400 }, "slow");
      return false;
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Best regards,
    Mike

    #1205516

    Hi Mike,
    I’ll give this a try. Thank you! I appreciate your help!

    #1205573

    Hi,

    Did you need additional help on this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1205981

    Hi Jordan,
    I just tried this but it did not work. Added it at the end of the functions.php file in wp-content/themes/enfold
    When I hit submit, the form just hung there and did not process.

    Thanks,
    Keith

    #1205982

    Note. Here is the relevant part of the error email I received.

    ———–Start—————
    WordPress version 5.4
    Current theme: Enfold (version 4.7.4)
    Current plugin: (version )
    PHP version 7.3.17

    Error Details
    =============
    An error of type E_COMPILE_ERROR was caused in line 807 of the file /var/www/vhosts/awsp.com/httpdocs/wp-content/themes/enfold/functions.php. Error message: Cannot redeclare custom_script() (previously declared in /var/www/vhosts/awsp.com/httpdocs/wp-content/themes/enfold/functions.php:780)

    #1206421

    Hi,

    Thanks for that, it looks like you have two functions with the same name. Please try this instead:

    function khickman_animate_custom_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $("#top.page-id-1167 input.button").click(function() {
      $("html, body").animate({ scrollTop: 400 }, "slow");
      return false;
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'khickman_animate_custom_script');

    Best regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.