JSFiddle - React, Tailwind, and code Playground
by klierik
HTML
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<div class="container">
<div class="sidebar">Блок 1</div>
<div class="content">Блок 2</div>
<div class="third-block">Блок 3</div>
</div>
CSS
.container {
max-width: 300px;
color: #fff;
}
.sidebar, .content {
min-height: 150px;
}
.sidebar {
width: 100px;
float: left;
background: #f00;
}
.content{
overflow: hidden;
background: #00f;
}
.third-block {
clear: both;
min-height: 100px;
background: #0f0;
}
JavaScript
function rotateBlocks(){
if( $( document ).width() <= 767 ) {
$('.sidebar').appendTo('.container');
} else {
$('.sidebar').prependTo('.container');
};
};
rotateBlocks();
$( window ).resize(rotateBlocks);