Site logo

Archived topic

Animated Hamburger menu: what is htmlEl?

4 replies · Started by Alessio on August 25, 2020

Viewing posts 1–5 of 5

Hi,
take a look at this code:

if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {

I took it from here: https://docs.generatepress.com/article/animated-hamburgers/

What does htmlEl mean? It's throwing a javascript error when navigating the menu:
javascript error htmlel

Hi there,

Looks like an undefined variable in the code. Just updated that function in the article, can you try now?

Let me know :)

Hi,

that's working now, thank you!!
Could you also add {passive: true} to the event listeners? Google PageSpeed is showing the warning that you should only use passive listeners.

Interesting, I wonder which event listeners need that. I'll do some tests.

Thanks!

Thank you for looking into it!
I've done an implementation myself but I don't know if it's correct. Please update me if you have made an improved version!

This archived topic is closed to new replies.