It is necessary to make the CSS animation to hide and display fields in the "main-wrap" by changing the height of the nested elements.
For example, cited two - "description" and "select-menu" .
At the same time, the menu can remain both minimized and maximized, and also none of the nested elements can have overflow:hidden . Therefore, max-height:0; to max-height: ...px max-height:0; to max-height: ...px not suitable.
We tried to implement transform scaleY(0 to 1) on transform scaleY(0 to 1) , but then the place occupied by the block remains, and we want to avoid this.
$(function() { $('.main-wrap').on('click', function() { var $this = $(this); if ($this.hasClass('minified')) { $this.removeClass('minified') } }); $('button').on('click', function(e) { $('.main-wrap').addClass('minified'); e.stopPropagation(); }); $('.select-menu-wrap').on('click', function() { $(this).toggleClass('visible-menu'); }); $('.select-menu-item').on('click', function() { $('.select-menu-title').addClass('is-selected').find('.selected').text($(this).text()); }); }); * { outline: none; } .main-wrap { border: 1px solid black; padding: 10px 10px 80px; position: relative; } .minified .description { display: none; } .minified .select-menu-wrap { display: none; } .minified button { display: none; } button { position: absolute; bottom: 0; left: 40%; } .select-menu-wrap { position: relative; margin-bottom: 10px; } .select-menu { display: none; padding: 4px; } .visible-menu .select-menu { display: block; } .selected { display: none; } .select-menu-title { padding: 4px; } .is-selected .selected { display: inline; } .is-selected .no-selected { display: none; } .description { margin: 10px 0; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="main-wrap minified"> <div class="title">Заголовок всегда виден. Нажмите на блок, чтобы развернуть</div> <div contenteditable="true" class="description">Тут пояснение, что к чему.</div> <div class="select-menu-wrap"> <div class="select-menu-title"> <span class="no-selected">Нажмите сюда, чтобы выбрать из списка</span> <span class="selected"></span> </div> <div class="select-menu"> <div class="select-menu-item">Позиция 1</div> <div class="select-menu-item">Позиция 2</div> <div class="select-menu-item">Позиция 3</div> </div> </div> <button type="button">Свернуть</button> </div> <div style="margin-top: 12px;">Здесь текст, чтобы видеть как блок с ним взаимодействует.</div>
overflow: hidden? - malginovdesign