I am currently designing a drawer that needs to slide from left to right when a button is clicked. I have attempted to achieve this using CSS transitions and jQuery, but unfortunately, it's not working as expected. Here is what I have tried so far:
$(document).ready(function() {
$(".openUserEditBox").on("click", function() {
$(".user-drawer").show();
});
});
.user-drawer {
position: relative;
width: 600px;
top: 50px;
background-color: #f2f2f2;
border: 1px solid #bbbbbb;
min-height: 450px;
float: right;
display: none;
left: 100px;
transition: left 1s ease-in-out;
}
.user-menu {
padding: 10px 20px;
position: absolute;
}
.btn-default {
background-color: #fff;
padding: 10px;
border: 1px solid #bbbbbb;
width: 150px;
}
.btn-default:hover {
cursor: pointer;
box-shadow: inset 0 1px 3px 0 #bbbbbb;
}
.btngroup {
float: right
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="btngroup">
<button class="btn-default openUserEditBox">Show Drawer</button>
<button class="btn-default closeUserEditBox">Hide Drawer</button>
</div>
<div class="userForm">
<div class="user-drawer">
<div class="user-menu">
<h1>Edit User</h1>
</div>
</div>
</div>