How to translate from js to jquery?

  • 0
    There is pure js, please help me translate into jquery and tell me how you can simplify the appearance and disappearance of the container? now it is done by layering, but it is inconvenient to use any specific ccc classes for the submenu, it turns out very cumbersome js, how to implement this on $ (this)? without specifying a unique submenu class, tried to implement it with toggle, but nothing worked (
    <script>
        const drop_btn = document.querySelector(".drop-btn .drop-meka");
        const tooltip = document.querySelector(".tooltip");
        const menu_wrapper = document.querySelector(".wrapper");
        const menu_bar = document.querySelector(".menu-bar");
        const setting_drop = document.querySelector(".setting-drop");
        const help_drop = document.querySelector(".help-drop");
        const setting_item = document.querySelector(".setting-item");
        const help_item = document.querySelector(".help-item");
        const setting_btn = document.querySelector(".back-setting-btn");
        const help_btn = document.querySelector(".back-help-btn");
          drop_btn.onclick = (()=>{
            menu_wrapper.classList.toggle("show");
            tooltip.classList.toggle("show");
          });
          setting_item.onclick = (()=>{
            menu_bar.style.display = "none";
            setTimeout(()=>{
              setting_drop.style.display = "block";
            }, 100);
          });
          help_item.onclick = (()=>{
            menu_bar.style.display = "none";
            setTimeout(()=>{
              help_drop.style.display = "block";
            }, 100);
          });
          setting_btn.onclick = (()=>{
            menu_bar.style.display = "block";
            setting_drop.style.display = "none";
          });
          help_btn.onclick = (()=>{
            help_drop.style.display = "none";
            menu_bar.style.display = "block";
          });
    </script>
    JavaScript Anonymous, Jun 18, 2020

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!