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
    }
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4b9a-1cf9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4b9a-1cf9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?