I'm looking to create a menu that functions similarly to the image shown
The red arrow signifies that when I click on the button, it will toggle the visibility of the menu
The orange arrow indicates that when the menu is hidden, the box should expand in width and vice versa
https://i.sstatic.net/LP5cv.png
Currently, I have created the HTML structure, but I am facing a couple of issues
1) The sliding effect doesn't occur simultaneously with hiding/showing the content. I would like it to hide and slide at the same time.
$("#menu_btn").on("click", function () {
var menu = $("#left_menu #btn");
if (menu.css('display') !== "none") {
$("#left_menu #btn").hide("slide", {direction: "left"}, 1000);
} else {
$("#left_menu #btn").show("slide", {direction: "right"}, 1000);
}
});
2) How can I integrate code to adjust the width after the sliding effect? Additionally, the box is positioned absolutely within the container - how can I maintain the same top position after expanding/reducing the content?
$(".content #bg").css("width","600");
$(".content #bg").css("width","1000");
Thank you for any assistance provided.