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. Many Anchor Links in Main Menu for Single Page

Many Anchor Links in Main Menu for Single Page

Scheduled Pinned Locked Moved General Discussion
8 Posts 2 Posters 212 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.
  • paulstolleP Offline
    paulstolleP Offline
    paulstolle
    wrote on last edited by
    #1

    Hi there,

    I added three anchor links to my main menu like https://paulstolle.com/start#projekte
    The first link is working smooth but the other two links are just jumping to the bottom of the page without a smooth transition.

    I tried different workarounds and ended up with the following code in my Custom <head> content :

    <script>
        window.laytheme.on('newpageshown', function(){
           if(window.location.hash.length > 0){
               var id = window.location.hash;
               if(jQuery(id).length > 0){
                    jQuery('html, body').animate(
                    { scrollTop: jQuery(id).offset().top },
                    { duration: 1200 });
               }
           } 
        });
    </script>
    

    Is there a solution that all links are directing to the locations where I set my id's?

    Thanks in advance!

    Paul

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

      Dear @paulstolle
      you did not give the div an ID with leistungen.
      Best!
      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • paulstolleP Offline
        paulstolleP Offline
        paulstolle
        wrote on last edited by
        #3

        Thanks for your quick response, @mariusjopen !

        I set the ID leistungen to the horizontal line above Leistungen. But even if I set the ID in a div in the text-editing-window it is not working and just jumping to the bottom of the page.
        The anchor links are also restraining the link to the main page if you click on Paul Alexander Stolle after clicking another menu-link.

        Any ideas why this is happening?

        Best, Paul

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear @paulstolle
          can you try with a different word and make sure that everything is correct and also that the ID is not used twice?
          Best!
          Marius

          Sorry… Just trying to isolate the problem…

          www.mariusjopen.world

          1 Reply Last reply
          0
          • paulstolleP Offline
            paulstolleP Offline
            paulstolle
            wrote on last edited by paulstolle
            #5

            Thanks for your help, @mariusjopen !

            I changed the three IDs to projects, services and contact and the site name to home.

            The menu links are set in Wordpress > Design > Menus as individual links like this:
            https://paulstolle.com/home#projects
            https://paulstolle.com/home#services
            https://paulstolle.com/home#contact

            Can you work with this?

            Best, Paul

            1 Reply Last reply
            0
            • mariusjopenM Offline
              mariusjopenM Offline
              mariusjopen
              Global Moderator
              wrote on last edited by
              #6

              Dear @paulstolle
              well. The page is not long enough to scroll more down. The projects anchor works.
              Best!
              Marius

              www.mariusjopen.world

              1 Reply Last reply
              0
              • paulstolleP Offline
                paulstolleP Offline
                paulstolle
                wrote on last edited by
                #7

                Oh, I see … Thanks, @mariusjopen !

                1 Reply Last reply
                0
                • mariusjopenM Offline
                  mariusjopenM Offline
                  mariusjopen
                  Global Moderator
                  wrote on last edited by
                  #8

                  Dear @paulstolle
                  :-D

                  Best!
                  Marius

                  www.mariusjopen.world

                  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
                  dafvD
                  dafv
                  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