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. Need Custom Coding for Lay Theme? Find 3rd Party Developers here.
  3. custom menu element

custom menu element

Scheduled Pinned Locked Moved Need Custom Coding for Lay Theme? Find 3rd Party Developers here.
3 Posts 2 Posters 95 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 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 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 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


        I also code custom websites or custom Lay features.
        💿 Email me here: 💿
        info@laytheme.com

        Our Web Development company: 100k.studio

        Want to tip me? https://www.paypal.com/paypalme/arminunruh

        Before you post:
        1. When using a WordPress Cache plugin, disable it or clear your cache.
        2. Update Lay Theme and all Lay Theme Addons
        3. Disable all Plugins
        4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

        This often solves issues you might run into

        When you post:
        1. Post a link to where the problem is
        2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
        3. If the problem is difficult to explain, post screenshots / link to a video to explain it
        Online Users
        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