What I want is for the two squares at each side to come together and become one i.e. one overlapping the other in the center of the wrapper. The problem I am having is that once they come together, one of the square drops down a level. Im not sure if this is achieved using jQuery or using CSS.
Please see my program here
$(document).ready(() => {
  $(".square").animate({
    backgroundColor: "red",
  }, 3000);
  $("#squareOne").animate({
    marginLeft: "+=45%",
  }, 800);
  $("#squareTwo").animate({
    marginRight: "+=45%",
  }, 800);
});#wrapper {
  width: ...;
  margin: 100px auto;
  border: 1px solid black;
}
.square {
  width: 100px;
  height: 100px;
  border: 1px solid black;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 10% 30px;
}
#squareTwo {
  position: relative;
  float: right;
}
#squareOne {
  position: relative;
  background: #fff;
}
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
  <div id="wrapper">
    <div class="square" id="squareOne"></div>
    <div class="square" id="squareTwo"></div>
  </div>
</body> 
     
    