Click the same button and switch between the left and right sides of the page.

clipboard.png
now you can click the button to slide the page to the left, but how do you click the same button again to make the page slide out?

                $(".sidebar-toggle").on("click",function(){
                    $(this).siblings(".sidebar").animate({
                        left: "0"
                    }).siblings().animate({
                        left: "300px"
                    });
                })
                <button type="button" class="btn btn-default btn-sm sidebar-toggle">
                      <span class="glyphicon glyphicon-align-justify"></span>
                </button>
                <aside class="sidebar">
                        
                        <div class="sidebar-nav">
                            <nav class="bd-links" id="bd-docs-nav">
                            
                            </nav>
                        </div>
                </aside>
                <section class="content">
                        <article id="main" class="centent-content">
                            
                        </article>
                </section>
Mar.05,2021

borrow your code to modify

let flag = true
$('.sidebar-toggle').on('click',function(){
    if (flag) {
        $(this).siblings('.sidebar').animate({
            left: '0'
        }).siblings().animate({
            left: '300px'
        });
        flag = false
    } else {
        $(this).siblings('.sidebar').animate({
            left: '-100%' // 
        }).siblings().animate({
            left: '0'
        });
        flag = true
    }
})
Menu