I'm getting some data using loop to HTML DIVs. There can have many more data. Data showing something like below code.There have two classes for DIVs (test one and test two )
How to show all of "test one" data first and then "test two" data.How can i do this with javascript or Jquery?
My fiddle.
HTML
<div class="container">
<div class="test one">1</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test two">2</div>
</div>
This can be achieved using the order property of flexbox:
.container {
display: flex;
flex-direction: column;
}
.test.two {
order: 2;
}
<div class="container">
<div class="test one">1</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test one">1</div>
<div class="test two">2</div>
<div class="test two">2</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With