Resized portlet will not collapse

Resized portlet will not collapse

Hi,

I have multiple collapsible/expandable portlets that can be resized. But when I resize one of them (vertically) that particular portlet is not collapsing afterwards. The other portlets are collapsing just fine. But the one that were used for resizing will not collapse properly after resize.

I have a working JS FIDDLE with the issue

My code:

  1. $( function() {
  2.   $( ".portlet" )
  3.       .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
  4.       .find( ".portlet-header" )
  5.         .addClass( "ui-widget-header ui-corner-all" )
  6.         .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");
  7.  
  8.     $( ".portlet-toggle" ).on( "click", function() {
  9.       var icon = $( this );
  10.       icon.toggleClass( "ui-icon-plusthick ui-icon-minusthick" );
  11.       icon.closest( ".portlet" ).find( ".portlet-content" ).toggle("fast");
  12.     });

  13.     $( "#expand-all" ).click(function() {
  14.       $( ".portlet-content" ).show( "fast" );
  15.         $( ".portlet-toggle" ).toggleClass( "ui-icon-plusthick ui-icon-minusthick");
  16.     });

  17.     $( "#collapse-all" ).click(function() {
  18.       $( ".portlet-content" ).hide( "fast" );
  19.         $( ".portlet-toggle" ).toggleClass( "ui-icon-minusthick ui-icon-plusthick");
  20.     });
  21.    
  22.     $( ".portlet" ).resizable({
  23.       alsoResize: ".portlet-content",
  24.       handles: 's',
  25.     });
  26. });

Help is much appreciated. Thanks