JavaScript BOOTSTRAP: rearrange order of different sized panels on mobile

I have a problem on how to rearrange my panels on mobile. The panels have different sizes. Pls see attach for the screenshot of the page in large screen (col-lg):

page in large panel

EDIT: The large screen layout is ok, since I don't want any spaces between rows because the panels are different in heights.

When I view it on mobile (col-xs), I get:
1st panel
4th panel
7th panel
2nd panel
5th panel
3rd panel
6th panel

Pls see image for the mobile screen:

page in mobile screen

I want to rearrange the locations of the panels in mobile (col-xs), so the arrangement would be like this:
1st panel
2nd panel
3rd panel
4th panel
7th panel
5th panel
6th panel

Pls see code snippet for my codes

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" target='_blank' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" 
		integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" 
		crossorigin="anonymous">
	</head>
	<body>
	<div class="container">

<!-- 1st panel -->		
			<div class="col-lg-4">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">1st</h3>
				  </div>
				  <div class="panel-body">
				    1st panel<br>
				    1st panel<br>
				    1st panel
				  </div>
				</div>
<!-- 4th panel -->		
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">4th</h3>
				  </div>
				  <div class="panel-body">
					4th panel<br>
					4th panel<br>
					4th panel<br>
					4th panel<br>
				  </div>
				</div>			
<!-- 7th panel -->		
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">7th</h3>
				  </div>
				  <div class="panel-body">
					7th panel<br>
					7th panel<br>
					7th panel<br>
					7th panel<br>
				  </div>
				</div>
			</div>
			
			
<!-- 2nd panel -->		
			<div class="col-lg-4">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">2nd</h3>
				  </div>
				  <div class="panel-body">
				    2nd panel<br>
				    2nd panel<br>
				    2nd panel<br>
				    2nd panel<br>
				    2nd panel<br>
				    2nd panel    
				  </div>
				</div>
<!-- 5th panel -->		
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">5th</h3>
				  </div>
				  <div class="panel-body">
					5th panel<br>
					5th panel<br>
					5th panel<br>
					5th panel<br>
				  </div>
				</div>
			</div>
		
<!-- 3rd panel -->		
			<div class="col-lg-4">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">3rd</h3>
				  </div>
				  <div class="panel-body">
					3rd panel<br>
					3rd panel<br>
					3rd panel  
				  </div>
				</div>
<!-- 6th panel -->		
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">6th</h3>
				  </div>
				  <div class="panel-body">
					6th panel<br>
					6th panel<br>
					6th panel<br>
					6th panel<br>
				  </div>
				</div>
			</div>	
				
	</div>
	</body>
</html>
Answer:1

Please follow Bootstrap grid system and options. I think using that you can solve your problem.

Link for Grid options

Link for Grid System

There are predefined sizes for devices. So, you can make every div, etc all devices compatible.

Answer:2

If you want two different sets of arrangements in large devices and extrasmall devices, you need to have two different sets of codes (since you are changing the order of the "div"s altogether, the grid system won't come to any aid.)

In bootstrap, you can pull or push columns. But rows cannot be moved based on devices.

For the specification you are wanting, What you can do is add the same code twice with visibility filtering-

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" target='_blank' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" 
        integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" 
        crossorigin="anonymous">
    </head>
    <body>
    <div class="container">

<!-- Only for large devices, will be visible only in large devices --> 
<!-- 1st panel -->      
            <div class="col-lg-4 hidden-md hidden-sm hidden-xs">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">1st</h3>
                  </div>
                  <div class="panel-body">
                    1st panel<br>
                    1st panel<br>
                    1st panel
                  </div>
                </div>
<!-- 4th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">4th</h3>
                  </div>
                  <div class="panel-body">
                    4th panel<br>
                    4th panel<br>
                    4th panel<br>
                    4th panel<br>
                  </div>
                </div>          
<!-- 7th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">7th</h3>
                  </div>
                  <div class="panel-body">
                    7th panel<br>
                    7th panel<br>
                    7th panel<br>
                    7th panel<br>
                  </div>
                </div>
            </div>


<!-- 2nd panel -->      
            <div class="col-lg-4 hidden-md hidden-sm hidden-xs">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">2nd</h3>
                  </div>
                  <div class="panel-body">
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel    
                  </div>
                </div>
<!-- 5th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">5th</h3>
                  </div>
                  <div class="panel-body">
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                  </div>
                </div>
            </div>

<!-- 3rd panel -->      
            <div class="col-lg-4 hidden-md hidden-sm hidden-xs">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">3rd</h3>
                  </div>
                  <div class="panel-body">
                    3rd panel<br>
                    3rd panel<br>
                    3rd panel  
                  </div>
                </div>
<!-- 6th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">6th</h3>
                  </div>
                  <div class="panel-body">
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                  </div>
                </div>
            </div>  

<!-- Only for extra small devices, will be visible only in mobile device -->


            <div class="col-xs-12 hidden-lg hidden-md hidden-sm">       
<!-- 1st panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">1st</h3>
                  </div>
                  <div class="panel-body">
                    1st panel<br>
                    1st panel<br>
                    1st panel
                  </div>
                </div>
<!-- 4th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">4th</h3>
                  </div>
                  <div class="panel-body">
                    4th panel<br>
                    4th panel<br>
                    4th panel<br>
                    4th panel<br>
                  </div>
                </div>          
<!-- 7th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">7th</h3>
                  </div>
                  <div class="panel-body">
                    7th panel<br>
                    7th panel<br>
                    7th panel<br>
                    7th panel<br>
                  </div>
                </div>

<!-- 2nd panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">2nd</h3>
                  </div>
                  <div class="panel-body">
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel    
                  </div>
                </div>
<!-- 5th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">5th</h3>
                  </div>
                  <div class="panel-body">
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                  </div>
                </div>

<!-- 3rd panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">3rd</h3>
                  </div>
                  <div class="panel-body">
                    3rd panel<br>
                    3rd panel<br>
                    3rd panel  
                  </div>
                </div>
<!-- 6th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">6th</h3>
                  </div>
                  <div class="panel-body">
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                  </div>
                </div>
            </div>

    </div>
    </body>
</html>
Answer:3

You can try some thing like this if it suits for your design

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" target='_blank' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" 
        integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" 
        crossorigin="anonymous">
    </head>
    <body>
    <div class="container">

<!-- 1st panel -->      
<div class="row">
            <div class="col-lg-4">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">1st</h3>
                  </div>
                  <div class="panel-body">
                    1st panel<br>
                    1st panel<br>
                    1st panel
                  </div>
                </div>
                        </div>
    <div class="col-lg-4">
<!-- 4th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">2nd</h3>
                  </div>
                  <div class="panel-body">
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel<br>
                    2nd panel    
                  </div>
                </div>  
    </div>
<!-- 7th panel -->  <div class="col-lg-4">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">3rd</h3>
                  </div>
                  <div class="panel-body">
                    3rd panel<br>
                    3rd panel<br>
                    3rd panel<br>
                    3rd panel<br>
                  </div>
                </div>
</div>
            </div>
<div class="row">

                <div class="col-lg-4">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">4th</h3>
                  </div>
                  <div class="panel-body">
                    4th panel<br>
                    4th panel<br>
                    4th panel
                  </div>
                </div>
                        </div>
    <div class="col-lg-4">
<!-- 4th panel -->      
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">5th</h3>
                  </div>
                  <div class="panel-body">
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                    5th panel<br>
                  </div>
                </div>  
    </div>
<!-- 7th panel -->  <div class="col-lg-4">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">6th</h3>
                  </div>
                  <div class="panel-body">
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                    6th panel<br>
                  </div>
                </div>
</div>
</div>
<div class="row">

                <div class="col-lg-4">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">7st</h3>
                  </div>
                  <div class="panel-body">
                    7th panel<br>
                    7th panel<br>
                    7th panel
                  </div>
                </div>


</div>

        </div>          


</body>
</html>
Answer:4

I'm writing a NodeJS service that requests data from APIs. Under load, I don't want to hammer the API with potentially hundreds of simultaneous requests, so I am trying to queue up the requests so ...

I'm writing a NodeJS service that requests data from APIs. Under load, I don't want to hammer the API with potentially hundreds of simultaneous requests, so I am trying to queue up the requests so ...

I'm learning electron and I've made an electron app that read and create files. When I start the application with "npm start" or "electron ." it works as intended but when I use the "npm run build" ...

I'm learning electron and I've made an electron app that read and create files. When I start the application with "npm start" or "electron ." it works as intended but when I use the "npm run build" ...

I am new to React. I am trying to display few locations over Google Maps using google-map-react. I am using the below source for it. import React, { Component } from 'react'; import GoogleMapReact ...

I am new to React. I am trying to display few locations over Google Maps using google-map-react. I am using the below source for it. import React, { Component } from 'react'; import GoogleMapReact ...

  1. react array iteration
  2. react array foreach
  3. react array loop
  4. react array foreach render
  5. react array foreach is not a function
  6. react array loop render
  7. react array foreach break
  8. react native array iteration
  9. react js array iteration
  10. react iterate array of objects
  11. react iterate array in render
  12. react iterate array jsx
  13. react iterate array component
  14. react iterate array of strings
  15. react iterate array key
  16. react loop array of objects
  17. react loop array jsx
  18. react loop array map
  19. react loop array of elements

I need a simple way to wait for setTimeout code to finish executing and then run the code that comes after setTimeout. Now the code after loop containing setTimout is executing before loop/setTimout ...

I need a simple way to wait for setTimeout code to finish executing and then run the code that comes after setTimeout. Now the code after loop containing setTimout is executing before loop/setTimout ...