Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Connect and find Help
  3. custom menu element

custom menu element

Scheduled Pinned Locked Moved Connect and find Help
3 Posts 2 Posters 473 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OLVVDBO Offline
    OLVVDBO Offline
    OLVVDB
    wrote on last edited by
    #1

    Hi everyone,

    [https://tomhallet.com/](link url)

    I’m running into a problem. I am creating a mega menu.

    On the initial page load, the menu works perfectly (mouse click event triggers the mega menu to display): clicking the “Exhibitions” menu trigger opens the mega menu. However, if I navigate away and then return to the homepage — either by clicking the logo or the browser back button — the mega menu no longer opens when I click the trigger.

    It seems like the .menu_trigger loses its functionality on these subsequent visits. I suspect it might be related to LayTheme’s PJAX or page caching behavior, but I’m not sure how to fix it.

    this is how I buiild it: Here’s how I built it:

    The menu trigger is a paragraph element:

    <p class="_Default menu_trigger" style="text-align: center; line-height: 0.8;">Exhibitions</p>
    

    When the menu is open, it adds the class is-open:

    <p class="_Default menu_trigger is-open" style="text-align: center; line-height: 0.8;">Exhibitions</p>
    

    The mega menu itself is a div with the class .megamenu containing a stack of columns with links:

    <div class="col ... megamenu ...">
      <div class="stack-wrap">
        <div class="stack-element">
          <div class="col ... type-text ...">
            <div class="text">
              <p><a href="...">Project 1</a></p>
              <p><a href="...">Project 2</a></p>
              ...
            </div>
          </div>
        </div>
      </div>
    </div>
    

    Has anyone experienced this before, or does anyone know how to ensure the mega menu works even after navigating back to the homepage?

    Thanks in advance for any help!

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      hey there!!

      binding click events should be done in a delegated way:
      https://laytheme.com/documentation/custom-javascript.html#binding-click-events

      then it should work

      1 Reply Last reply
      0
      • OLVVDBO Offline
        OLVVDBO Offline
        OLVVDB
        wrote on last edited by
        #3

        Great, Thnx Armin!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        Online Users
        M
        Marcal
        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
        laytheme.com
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • Users
        • Search