Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I tried to trigger a transition with javascript, but is not working,

So, i’m very new to html, css and javascript, and i trying to trigger a transition with javascript, but it’s not working, "menu-icon" it’s a span tag with a litle image that is inside another div, that’s also inside the header, here’s the code (i’m using microsoft edge).

<script>
  const openMenu = document.querySelector('.menu-icon');
  openMenu.addEventListener('click', () => {
    openMenu.style.transform.scaleX = 100%;
  });
</script>

The edge DevTools said that it was a syntax error (a bracket on the line 5, column 1), but when I deleted it, it said that it was the parenthese next to it, I deleted it, and now it says there’s not an end for the input.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Please use this code instead:

<script>
  const openMenu = document.querySelector('.menu-icon');
  openMenu.addEventListener('click', () => {
    openMenu.style.transform = "scaleX(100%)";
  })
</script>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading