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. Bug Reports
  3. Anchor link in mobile not working anymore

Anchor link in mobile not working anymore

Scheduled Pinned Locked Moved Bug Reports
9 Posts 4 Posters 424 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.
  • B Offline
    B Offline
    benjmaier
    wrote on Nov 26, 2020, 3:50 PM last edited by
    #1

    Hello!

    I couldn't find anything on this specific problem so I post here.
    I used the code for anchor scroll animations found on this website:

    <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-70 },
                    { duration: 1200 });
               }
           } 
        });
    </script>
    

    In the beginning everything worked fine but after some time it stopped working for my mobile site and I could not explain why.

    My main page is a category page which links to a page with all projects. It should scroll to the clicked project right away with a link like this: [https://benjaminmaier.it/portfolio/works/#mzw ](link url)

    I know there is a slash before the hashtag but it works for the desktop site. Tested on different mobile browsers and resized desktop browsers. The link just leads to the top of the page with all projects.

    Anyone knows a solution?
    Thanks and kind regards,
    Ben

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Richard
      Global Moderator
      wrote on Nov 28, 2020, 4:31 AM last edited by
      #2

      Dear Ben @benjmaier

      I ran into a similar problem here, which i thought was due to a .click() event not firing ( bottom of thread ):

      http://laythemeforum.com:4567/topic/6044/single-page-website-with-everything-on-display-organized-by-category/12

      But you have the same issue - it may be connected...
      Will forward this and hopefully Armin can help us understand the change in Mobile :)

      Best wishes
      Richard

      B 1 Reply Last reply Nov 30, 2020, 3:38 PM
      1
      • A Offline
        A Offline
        arminunruh
        Global Moderator
        wrote on Nov 30, 2020, 3:00 PM last edited by arminunruh Nov 30, 2020, 10:01 AM
        #3

        Hey please remove all custom javascript code related to anchorscrolling.
        Since a while there's no custom code needed for this, it is built into laytheme.

        Meaning remove the javascript code that you posted here.

        And make sure lay theme is up to date.
        Now try again and see if it works. If not, let Richard know and then you can lemme know @Richard-K

        1 Reply Last reply
        0
        • R Richard
          Nov 28, 2020, 4:31 AM

          Dear Ben @benjmaier

          I ran into a similar problem here, which i thought was due to a .click() event not firing ( bottom of thread ):

          http://laythemeforum.com:4567/topic/6044/single-page-website-with-everything-on-display-organized-by-category/12

          But you have the same issue - it may be connected...
          Will forward this and hopefully Armin can help us understand the change in Mobile :)

          Best wishes
          Richard

          B Offline
          B Offline
          benjmaier
          wrote on Nov 30, 2020, 3:38 PM last edited by
          #4

          Hello Richard, @Richard-K
          thanks for your answers. As Armin recommended I removed all the code, updated lay theme and then I put the code in again.
          Sadly it still will not work. Without the js-code the anchors work but without the scrolling.

          Furthermore only the menu bar works in my main mobile browser, which would be opera. On other browsers the site works but the scroll does not.

          Thanks

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Richard
            Global Moderator
            wrote on Dec 3, 2020, 9:15 AM last edited by Richard Dec 3, 2020, 4:18 AM
            #5

            Dear @benjmaier

            Regarding the Issue with Opera, since the last update many people are reporting this, and Armin is solving it as soon as he can, sorry if this has caused problems for you.

            Regarding your anchor scroll question for Armin, have forwarded this, & will keep you updated!

            Best wishes
            Richard

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Richard
              Global Moderator
              wrote on Dec 8, 2020, 2:26 AM last edited by
              #6

              Dear @benjmaier

              A new update has been released regarding the Firefox and Opera issues :)

              Best
              Richard

              1 Reply Last reply
              0
              • A Offline
                A Offline
                arminunruh
                Global Moderator
                wrote on Dec 10, 2020, 3:15 PM last edited by
                #7

                hey @benjmaier

                actually i have never tested lay theme for opera since it is not a widely used browser :|

                does it work now?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  and
                  wrote on Dec 16, 2020, 11:44 AM last edited by
                  #8

                  Dear @Richard-K / @arminunruh ,
                  I updated Lay Theme and removed my custom code but unfortunately that didn’t do the trick.

                  Smooth scrolling doesn’t work unless I add some js-code (or 'html{scroll-behavior: smooth;}' in the custom CSS).

                  And the menu doesn’t work at all on mobiles (unless I leave the phone layout as it is, without customising it, which unfortunately is not an option. I explained this behaviour in detail here)

                  Should you have any updates please let me know.
                  Thanks again,
                  Andrea

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Richard
                    Global Moderator
                    wrote on Dec 19, 2020, 1:31 AM last edited by
                    #9

                    Dear Andrea @and

                    Could you please send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com ?
                    And will try to get this sorted out as soon as possible :)

                    Thank you for using Lay Andrea and sorry for any delay

                    Best
                    Richard

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

                    9/9

                    Dec 19, 2020, 1:31 AM


                    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
                    S
                    slartislart
                    16 minutes ago
                    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.
                    9 out of 9
                    • First post
                      9/9
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Search