jQuery UI resizable - limit to parent width, and leave height to auto
<p>I do need to use jQuery UI resizable with parent limits only to width, and leave height to auto. </p>

<p>As i see it's not possible through regular way, and we have to do something else through jQuery. I've already tried through event <code>resize</code>, to get <code>current height of resizing element</code> and compare is it close to a <code>parent</code> height, if it's <code>close</code>, i would increase <code>height</code> of <code>parent</code> and i'm okay. </p>

<p>But the problem is, it happens (height increased), but jquery ui <code>keeps somewhere</code> the <code>height</code> of a parent when it started with resize of a element, and it has no effect untill you stop resizing, and try again <em>(it will repeat step, increase once, and won't recognize increased area of parent, untill it's stopped, and started again).</em></p>

<p><strong>I've created snippets why do i need to use <code>containment</code> instead of only <code>maxWidth</code>.</strong></p>

<p>I hope someone has some method to do this, i wouldn't mind if someone has idea to do it through <code>maxWidth</code> but to has same effect as in snippet with <code>containment</code>.</p>

<p>With <code>containment</code> it allows me to have two blocks at one row, and when i resize last one to the end, it won't pass to second row, but with <code>maxWidth</code> it does pass to next row (that's why <code>maxWidth</code> can't help me).</p>

<p>The snippet:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#body {
    width: 500px;
    border: 1px solid red;
    min-height: 50px;
    padding: 10px;
    height: 50px;
}

.blocks, .blocks2 {
   border: 1px dashed gray;
   display: inline-block;
   min-height: 32px;
   width: 150px;
}

#body2 {
    width: 500px;
    border: 1px solid red;
    min-height: 50px;
    padding: 10px;
    height: auto;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/&gt;
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;

With containment:&lt;br&gt;
&lt;div id="body"&gt;
  &lt;div class="blocks"&gt;test my block&lt;/div&gt;
  &lt;div class="blocks"&gt;resize this to end&lt;/div&gt;
&lt;/div&gt;

&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;div style="color: #003c98;"&gt;As you can see, second with max-width, goes to next row, but i want to keep it to end if theres two or more of divs at inline position&lt;/div&gt;

&lt;div id="body2"&gt;
  &lt;div class="blocks2"&gt;test my block&lt;/div&gt;
  &lt;div class="blocks2"&gt;resize this to end&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
var body_height = 50;
$(function(){
  
  $('.blocks').resizable({
   maxWidth: 500,
      minHeight: 32,
   minWidth: 15,
   containment: "#body",
      resize: function( event, ui ) {
        if (ui.size.height &gt;= body_height-50) { 
            body_height += 100;
            $('#body').css('height', body_height);
        }
      }
  });
  
  $('.blocks2').resizable({
   maxWidth: 500,
      minHeight: 32,
   minWidth: 15
  });
  
});
&lt;/script&gt;</code></pre>
</div>
</div>
</p>

<p>Thank you all for your time.</p>