Notifications
Clear all

[Solved] Inverse drop animation for comment form after Submit

11 Posts
2 Users
0 Reactions
1,498 Views
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Is there a way to close back the form to show only the first textarea after the user has submitted? Possibly with the same animation?

Right now I forced a display:none of .wc-form-footer on submit using jquery.

The goal is to show the user a feedback of his comment being posted.

Thanks

This topic was modified 5 years ago by angelochiacchio

   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6191
 

Hi @angelochiacchio,

Please follow the steps below:

1. Put the following js code in the js files of the active theme:

wpdiscuzAjaxObj.wpdiscuzSlideUp = function () {
var parent = jQuery('.wc-main-form-wrapper');
jQuery('.commentTextMaxLength', parent).hide();
jQuery('.wc-form-footer', parent).slideUp(wpdiscuzAjaxObj.wpdiscuz_options.enableDropAnimation ? 500 : 0);
jQuery('.wc_comment', parent).focusout();
}

Helpful article: https://www.collectiveray.com/add-javascript-to-wordpress

2. The PHP code below should be put in the active theme's functions.php file:

add_filter("wpdiscuz_comment_post", function ($r){
$r["callbackFunctions"][] = "wpdiscuzSlideUp";
return $r;
});

   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Thank you,

it doesn't work. Is the procedure the same while using a child theme?


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Actually the function is called but not recognized

Screenshot 2020 04 07 at 14.29.13

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6191
 

@angelochiacchio

Please try to add the js code in the wpDiscuz plugin js codes. The wpdiscuz.js file is located in the /wp-content/plugins/wpdiscuz/assets/js/ folder. 

Don't forget to remove it from the previous place you've added. 


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

I works now! Thanks a lot!

This post was modified 5 years ago by angelochiacchio

   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

However in doesn't seem to be working on mobile, which is more important. Any idea why?


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

You can test it at http://ideasfortomorrow.me/


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6191
 

@angelochiacchio,

Probably this is just a cache issue. Please try on incognito mode. Because mobile browsers have a hard cache, you'll not be able to see the change immediately.


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Indeed. It is working fine now. Thank you!


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6191
 

@angelochiacchio,

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.


   
ReplyQuote
Share:
Scroll to top