I am trying to create a pair of resizable sidebars using jQuery and jQueryUI (but not completely necessary).
The issue I am running into is that it doesn't resize properly. The right sidebar is giving me issues as it resizes the left works completely fine. I want to know how to mimic the behavior of the left side bar in regards to how it works well for the right sidebar
I don't know how to fix it, split.js was recommended but I can't get that to work. My project is a simple one that shouldn't require a complicated set up, any help will do.
$(function() {
$(".left-sidebar").resizable({
handles: "e",
minWidth: 100,
maxWidth: 500,
});
$(".right-sidebar").resizable({
handles: "w",
minWidth: 100,
maxWidth: 500,
});
});
body,
html {
height: 100%;
margin: 0;
padding: 0;
}
.container {
display: flex;
height: 100%;
}
.left-sidebar,
.right-sidebar {
background: #f0f0f0;
width: 300px;
overflow: hidden;
position: relative;
}
.main-content {
flex: 1;
background: #e0e0e0;
}
<div class="container">
<div class="left-sidebar">
Left Sidebar Content
</div>
<div class="main-content">
Main Content
</div>
<div class="right-sidebar">
Right Sidebar Content
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css" />
Is this what you want ?
You could set left to 0 during resize by adding this :