I am currently working on a page that contains a form with two different sections - one is visible and the other is hidden. When the user clicks a button in the first section, it slides up using slideUp() while the hidden section slides down using slideDown(). However, I have encountered a problem where the first section moves to the left momentarily before returning to its original position once the hidden section slides down. I suspect this issue may be related to another div located next to the form, as removing it resolves the problem. I am unsure of what is causing this behavior and would greatly appreciate any assistance.
Here are the HTML divs:
<div class="tips">
//irrelevant
</div>
<form action="rideHandler.php" method="POST" id="tripinfo">
<div class ="choosing" id="choosing" >
<button type="button" class="subBtn" id="show"> Finish up</button>
</div>
<div class="confirmation" id="confirmation" style ="display:none";>
</div>
</form>
JavaScript code for the click event:
$('#show').click(function(e) {
$("#choosing").slideUp();
$("#confirmation").slideDown();
CSS styling used:
.tips{
background-color: white;
display:inline-block;
float: right;
width:20vw;
height:35vw;
padding:80px;
margin-right:50px;
text-align: center;
border: 2px solid;
border-width: 3px 4px 3px 5px;
border-radius:95% 4% 92% 5%/4% 95% 6% 95%;
transform: rotate(2deg);
margin-top:90px;
}
.choosing, .confirmation{
margin: 0 auto;
margin-bottom: 40px;
padding:20px;
width:35vw;
text-align: center;
background-color: whitesmoke;
border: 3px solid;
margin-top:100px;
}