Hello! Problem, I want a menu to open by clicking on the picture, I made the menu myself, I just need to change the position of the menu by clicking on the picture.

Hi @Javer - can you share more details like a screenshot or what your current markup/code looks like?

Kirupa :grinning:

I have already removed the script because it did not work, I did it as in the book on chapter 30

<a href="#" class="logo" id="setting"><img src="/Users/daniil/Documents/qwins/png/imgonline-com-ua-Resize-xxZoL2fDi8Sp.png"></a>

     let setting-menu = document.querySelecor("#setting");
     setting-menu.addEvenListener("click",menu_open, false);

     function menu_open(e){ = "20px solid darkred";


here is the code. relying on a book


When you check in the console, what error are you seeing? Here is a guide on how to work with the console: Console Logging Basics

Now, one thing that seems off is the spelling of your properties:

  • querySelecor should be querySelector
  • addEvenListener should be addEventListener

Once you make these spelling updates, see if your code works. If it still doesn’t work, check the Console (using the guide from the earlier link if you aren’t sure how to do that) and let me know what errors you see.


writes no errors, but the code still does not work exactly

Did you fix the spelling of the misspelled properties? Can you paste a screenshot of what it is that you currently are seeing in your browser when you try to run this app?

throw something else? @kirupa

When I ran the snippet you posted, the Console showed me another error:

It turns out you can’t name a variable as setting-menu where you have the - character. Also, this line “” doesn’t work either. What does document.logo refer to here?

Here is a working example where clicking on the image gives it a border:

Take a moment and see where the book’s instructions and what you have differ. JavaScript isn’t very forgiving of misspellings and syntax errors. You have to ensure your code is exactly as specified.

Hopefully this helps :slight_smile:

helped, thanks.
And how to make it so that when you click in an empty area, this frame disappears in the picture? @kirupa

You can listen for a click event on the body element and essentially undo the inline style you are setting on the image.

Two tutorials that can help you out:

Good afternoon, the problem is not solved. I don’t understand how to make it so that when you click on the picture, the property of another class changes, that is, I made a menu and indicated an indent from the right -100%, it is necessary that when you click on the picture this indent disappears (that is, it was 0%), I think I clearly explained . Sorry for such stupid questions :slight_smile:


This tutorial sounds like it can help you out: Creating a Smooth Sliding Menu | KIRUPA

What it highlights and what you describe trying to do are very similar :grinning: