I need to make these cards in list mode and grid mode I am using flex-column to leave the dynamic grids more when I add the cards they do not work anymore this is the layout mode of my layout:
andthisisanoutlineofgridmode:
followmycode:
$(".button-thumb").click(function() {
if ($(this).val() != "grid") {
$("#list-grid").addClass("flex-column");
$('#list').addClass('active');
$('#grid').removeClass('active');
} else {
$("#list-grid").removeClass("flex-column");
$('#grid').addClass('active');
$('#list').removeClass('active');
}
});
background-color: $light-gray;
padding: 15px;
.active {
color: $orange;
}
button {
cursor: pointer;
border: 0;
background-color: transparent;
outline: none;
color: $gray;
@include transition(all, .2s);
&:hover {
color: $orange;
}
}
label {
margin: 0;
font-family: 'Open Sans', sans-serif;
color: $gray;
}
select {
outline: none;
border: 0;
background-color: transparent;
color: $gray;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkrel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script><linkrel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" />
<div class="row mt-3">
<div class="col-md-12 text-right">
<div class="box-lists">
<button id="list" class="button-thumb active" value="list"><i class="fas fa-list-ul"></i></button>
<button id="grid" class="button-thumb" value="grid"><i class="fas fa-th"></i></button>
<label for="select"> | Ordenar por:</label>
<select id="select">
<option value="">Mais Próximo</option>
<option value="">Mais Distante</option>
<option value="">Mais visitados</option>
<option value="">Mais avaliados</option>
</select>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-8">
<div id="list-grid" class="row flex-column">
<div class="col-xs-2">
<div class="card mb-3">
<img class="card-img-top" src="http://via.placeholder.com/350x150"alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
<div class="col-xs-2">
<div class="card mb-3">
<img class="card-img-top" src="http://via.placeholder.com/350x150"alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
</div>
</div>