I have div, once it clicked on the text changes from Category to list that I have under display: none,  the click triggers it to display: block.
I got that part working, but I have no idea how to make the transition so the width will stretch smooth and not all at once.
  $(document).ready(function(){
    $( '#cat' ).click(function() {
      if($('#cat').hasClass('open')){
          $('#cat').removeClass('open');
      }
      else{
          $('#cat').addClass('open');
      }
    });
  });.categories #cat{
    z-index: 10;
    border: 1px solid black;
    padding: 10px 70px;
    background-color: black;
    color: white;
    cursor: pointer;
    outline: none;
    display: inline-block;
    transition: all 300ms linear;
}
.list{
  display: none;
  list-style: none;
  padding: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
.list li{
  display: inline-block;
  margin: 0 5px;
}
.open .list{
  display: block;
}
.open span{
  display: none;
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="categories">
      <br/>
      <h1>New Collection</h1>
      <br/>
        <div id="cat">
          <span>Categories</span>
          <ul class="list">
            <li>test</li>
            <li>test</li>
            <li>test</li>
            <li>test</li>
            <li>test</li>
          </ul>
        </div>
    </div>I have tried adding transition: all 300ms ease-in-out and/or linear, none worked.
Tried also using animate() in jquery, and css().
How can I display element width change smoothly?
 
    