How to replace .toggle function since deprecated with add/remove class and slide up/down of siblings?

How to replace .toggle function since deprecated with add/remove class and slide up/down of siblings?

Hi, I'm a beginner. I have this code who works fine but is pointed as deprecated by jQuery migrate. How can I change it?

  1.   !  jQuery(".toggle_title").toggle(
  2.         function(){
  3.             jQuery(this).addClass('toggle_active');
  4.             jQuery(this).siblings('.toggle_content').slideDown("fast");
  5.         },
  6.         function(){
  7.             jQuery(this).removeClass('toggle_active');
  8.             jQuery(this).siblings('.toggle_content').slideUp("fast");
  9.         }
  10.     );
Maybe something like this will do the trick but as $.fn.toggleClick is not a function it won't work (maybe I need to put the first part in another file/folder?:

  1. $.fn.toggleClick = function() {
  2.   var functions = arguments,
  3.       iteration = 0;
  4.   return this.click(function() {
  5.     functions[iteration].call(this);
  6.     iteration = (iteration + 1) % functions.length;
  7.   });
  8. }

  1. $(".toggle_title").toggleClick(function() {
  2.             $(this).addClass('toggle_active');
  3.             $(this).siblings('.toggle_content').slideDown("fast");
  4. }, function() {
  5.   $(this).removeClass('toggle_active');
  6.             $(this).siblings('.toggle_content').slideUp("fast");
  7. });