I am using two Bootstrap cards. I conceal one of the cards (which is blue in colour) behind a card (which is white in colour) as illustrated below:
...and use the following code to reveal the concealed blue card behind the white card:
$(document).ready(function(){
$(".card-horizontal").click(function(){
$(".backPanel").slideDown("slow");
});
});
resulting in the desired below illustrated effect:
The issue I am having here is that the length of the revealed blue card isnt consistant as it is varies in revealed length depending on the dimensions as illustrated below:
Using the Chrome Developer Tools, in Mobil S-320px it reveals this much:
At Mobil M-375px it reveals a little less as illustrated below:
At Tablet-768 it reveals even less:
How can I ensure that the card reveal length is consistant regardless of the handheld dimensions?
Find below my HTML for both the white .card card-horizontal:
<div class="col-md-12 mb-3">
<div class="card w-75 card-horizontal" >
<div class="img-square-wrapper">
<img class="nftImages" src="http://via.placeholder.com/150" alt="Card image cap">
<div class="card-body cardPadding">
<h5 class="card-title">Card title</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
</div>
and the code for the blue concealed card .backPanel
<div class="card w-75 card-horizontal backPanel">
<div class="img-square-wrapper">
<div class="card-body ">
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
Find below my CSS files for the white card:
.card {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0.25rem;
}
...and the CSS for the blue card:
.backPanel {
position: absolute !important;
display: none;
top: -75px;
z-index: -5;
width: 99.5%;
left: 1px;
margin-block: auto;
background-color: blue;
box-shadow: 0 0px 0px 0px #343434 !important;
}
you can use javascript/jquery to set height and width of your element; here's an exmaple :