Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • 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. General Discussion
  3. Anchor links within project overlay issues

Anchor links within project overlay issues

Scheduled Pinned Locked Moved General Discussion
5 Posts 2 Posters 61 Views
  • 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.
  • R Offline
    R Offline
    rospax
    wrote on last edited by
    #1

    Hello @arminunruh,

    I have my project pages set up as overlays, example here.
    Each page consists of 2 browser height rows.

    What I'm aiming for is the anchor link when clicking "read more" button smoothly scrolls you down to the project text row, below the carousel of images.

    I have achieved this using the css:

    html {
    scroll-behavior: smooth!important;
    }

    There are two issues with this:

    1. the smooth scroll works when the page is re-loaded (i.e. not in overlay mode) but the css seems ineffective when the overlay is active, it just jumps down super fast.

    2. When overlay is active, the anchor link jumps to correct point (top of the row) but when the page is reloaded the anchor jumps further down and doesn't seem to respect the browser-height row.

    Due to the overlay being active only when navigating within the site (i.e. not when you arrive from google or another link) it's important that both "versions" of the page behave in the same way.

    I hope that all makes sense - Any ideas what I am missing here?

    Thanks for all your brilliant work and help so far!

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rospax
      wrote on last edited by
      #2

      OK - I figured out point no. 2, had the wrong settings.

      Would still love some help with point 1, just getting a smoother scroll in the overlay mode :)

      Thanks,

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

        hey so you can use anchors:
        https://laytheme.com/documentation/jump-to-anchor.html

        doing this, you wont need

        html {
        scroll-behavior: smooth!important;
        }

        because using the built in way, theoretically it should already smooth scroll.
        also you can use the settings:
        Screenshot 2025-03-03 at 17.05.38.png

        in Lay Options.

        however, if you want to code your own scrolling logic, you need to be aware that not only the html element scrolls.

        in a project overlay, the element #lay-project-overlay scrolls
        in a page overlay, the element .lay-overlay>.lay-content scrolls

        so your css could be:

        html, body,
        #lay-project-overlay,
        .lay-overlay>.lay-content{
        scroll-behavior: smooth!important;
        }
        
        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote on last edited by
          #4

          or if you use javascript:

          https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
          https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

          both of these functions can be used with
          behavior: "smooth",
          optionally

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rospax
            wrote on last edited by
            #5

            Thanks @arminunruh , the CSS targeting the overlay did the trick, although it's not super smooth it's a big improvement!

            I'm sure there's a way to fine tune it with JS but that's probably beyond my skill level.

            Many thanks!

            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

            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