I Try to find how to collapse all cat by default in other word
In that case, then try this script (replace the one you have now):
<script>
( function ( $ ) {
$( 'li.has-children', '#cat-drop-stack' ).on( 'click', '> a span.caret-icon', function ( e ) {
e.preventDefault();
var self = $( this ),
submenu = self.closest( 'li.has-children' ).find( '> ul.children' );
if ( !submenu.is( ':visible' ) ) {
self.find( 'i.fa' ).addClass( 'fa-rotate-90' );
if ( submenu.hasClass( 'level-0' ) ) {
self.closest( 'a' ).css( { 'borderBottom': 'none' } );
}
}
submenu.slideToggle( 'fast', function () {
if ( !$( this ).is( ':visible' ) ) {
self.find( 'i.fa' ).removeClass( 'fa-rotate-90' );
if ( submenu.hasClass( 'level-0' ) ) {
self.closest( 'a' ).css( { 'borderBottom': '1px solid #eee' } );
}
}
} );
} )
.find( '> ul.children' ).hide().end()
.filter( '.level-0' ).find( '> a span.caret-icon' ).click();
} )( jQuery );
</script>