[Support request] Animated Hamburger menu: what is htmlEl?

Home Forums Support [Support request] Animated Hamburger menu: what is htmlEl?

Home Forums Support Animated Hamburger menu: what is htmlEl?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1417659
    Alessio

    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

    #1418097
    Tom
    Lead Developer
    Lead Developer

    Hi there,

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

    Let me know 🙂

    #1418119
    Alessio

    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.

    #1419251
    Tom
    Lead Developer
    Lead Developer

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

    Thanks!

    #1419677
    Alessio

    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!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.