Sure. You can use the jQuery slow method, or any other jQuery effect you like. There are a couple parts to the solution.
1. Hide the .gform_confirmation_message by using display:none; in your theme's stylesheet. This is the code for form 3 in my installation:
[css]
div.gform_confirmation_message_3 {
display:none;
}
2. We're going to use the gform_confirmation_loaded hook, so be sure you enabled AJAX when you embedded the form. Add this to your existing shortcode if you are not currently using AJAX:
[php]
ajax="true"
3. Create a script called slow-confirmation.js and save it in the js folder of your child theme. Put this into that script (be sure to hover over this code block and click the <> "view source" to see the full code):
[js]
jQuery(document).bind('gform_confirmation_loaded', function(){
jQuery('#gforms_confirmation_message').slideDown('slow');
});
4. Add this to your theme's functions.php to enqueue the script which you named slow-confirmation.js and saved in the js folder of your child theme. If you placed the script elsewhere or named it something else, adjust these values. Change the "3" here to your form ID.
[php]
add_action('gform_enqueue_scripts_3', 'enqueue_slow_slide', 10, 2);
function enqueue_slow_slide($form, $is_ajax) {
// enqueue the slow slide script which is bound to the gform_confirmation_loaded event. Located in the child theme /js/ subdirectory. Depends on jQuery
wp_enqueue_script('slow-confirmation', get_stylesheet_directory_uri() . '/js/slow-confirmation.js', array('jquery'));
}
Example: http://gravity.chrishajer.com/country-of-origin/
Posted 12 years ago on Thursday September 13, 2012 |
Permalink