M
M
mr_firuzinho2018-03-25 16:11:00
JavaScript
mr_firuzinho, 2018-03-25 16:11:00

How can I make the menu disappear when clicked?

Hello, there is a menu on the site:

//Чекбокс нужен для открытия меню, через :checked
                       <input type="checkbox" id="hmt" class="hidden-menu-ticker">
                        //Гамбургер, это три линии, обычно используемые в качестве кнопки для открытия меню
      <label class="btn-menu" for="hmt">
        <span class="first"></span>
        <span class="second"></span>
        <span class="third"></span>
      </label>
                       //Это само меню
      <ul class="hidden-menu">
                                ...
                           //три точки означают, что тут много чего, что не влияет на суть вопроса
                         </ul>

This menu has styles, key:
position: fixed;
right: -200px;

When you click on the hamburger (when the checkbox is activated), the menu appears by nulling "right" like so:
.hidden-menu-ticker:checked ~ .hidden-menu {
            right: 0;
      }

That is, the functionality is completely written in css.
Task:
How to make it (menu) closed when clicking on menu items (links)?
Wrote both js and jQ code - does not work. The jq version is appropriate. The code was inserted into both the header and the footer.
PS
Before writing, I searched for 2 days in Google, please do not write "Googling". In general, this word in a toaster deprives the meaning of a toaster.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rosaline, 2018-03-25
@mr_firuzinho

https://www.youtube.com/watch?v=YVBOQXx5kdo&index=...
at 3:42 the answer to your question))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question