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. 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 877 Views 1 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.
  • paulstolleP
    paulstolleP
    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
      mariusjopenM
      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
        paulstolleP
        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
          mariusjopenM
          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
            paulstolleP
            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
              mariusjopenM
              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
                paulstolleP
                paulstolle
                wrote on last edited by
                #7

                Oh, I see … Thanks, @mariusjopen !

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

                  Dear @paulstolle
                  :-D

                  Best!
                  Marius

                  www.mariusjopen.world

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  Online Users
                  L
                  lukas123
                  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