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. Submenu anchor not clickable when on another page + on mobile menu !

Submenu anchor not clickable when on another page + on mobile menu !

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 206 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.
  • S Offline
    S Offline
    sofiapapa08
    wrote on last edited by sofiapapa08
    #1

    Hi,

    Here is the website I am working on www.artefax.ch
    I have a few issues with the system of anchor on my menu:

    1. When on dekstop: if i am on on "main" menu (like "à propos") and i click on submenus ("association", "musique" or "ateliers") it works. BUT, when I am on another page, for example "actualités" and I want to go straight to another submenu (hover "à propos" and click on the submenu "musique"), it doesn't work.

    2. On mobile menu, submenus and the menu that include submenus are not clickable at all. How can I manage it?

    I followed the steps Armin explained on this http://laythemeforum.com:4567/topic/2863/link-to-anchor-from-another-page/5
    In my custom head content, I have this script:

    <script>
        
        jQuery(document).on( 'click', 'a[href^="#"]', function(e){
            e.preventDefault();
            var hash = jQuery(this).attr('href');
            var el = jQuery(hash);
            var top = el.offset().top;
            jQuery('html, body').animate({
                scrollTop: top
            }, 300, 'swing',
                function() {
                    window.location.hash = hash;
                }
            );
        } );
        
        window.laytheme.on('newpageshown', function(){
            var hash = window.location.hash; 
            var el = jQuery(hash);
            if(el.length > 0) {
                var top = el.offset().top;
                window.scroll(0, top);        
            }
        });
        
    </script>
    
    <script>
    window.laytheme.on("newpageshown", function(layoutObj, type, obj){
        
      jQuery("body").append('<div class="pointer"></div>');
        jQuery("body").on("mousemove", function(e) {
    	jQuery("nav.laynav .menu-item>a span").css({ top: e.clientY + "px", left: e.clientX + "px" });
    	
    });
    
      });
    </script>
    
    <script>
    jQuery(document).ready(function(){
    jQuery('li.menu-item a').addClass('scrollTo');
    });
    </script>
    

    3. Last question : I am here https://www.artefax.ch/services/, when I click on the link of Mike, I want to open automatically the anchor of Mike's profile in "à propos" menu > "musique" submenu > Mike Kundaeli anchor. Is it possible? Otherwise I'll create simple page for each profile. See image below.
    link1.png
    Mike_profile.png

    A bit urgent cause I need to present the website on tuesday 😰 If someone could help me before that, would be incredible ❤️
    Thanks a lot

    Sofia

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sofiapapa08
      wrote on last edited by
      #2

      @sofiapapa08 said in Submenu anchor not clickable when on another page + on mobile menu !:

      jQuery(document).on( 'click', 'a[href^="#"]', function(e){
      e.preventDefault();
      var hash = jQuery(this).attr('href');
      var el = jQuery(hash);
      var top = el.offset().top;
      jQuery('html, body').animate({
      scrollTop: top
      }, 300, 'swing',
      function() {
      window.location.hash = hash;
      }
      );
      } );

      Hi!
      I solved the question 1 and 2 by removing some things in the custom head content, here is my new code

      <script>
          
          window.laytheme.on('newpageshown', function(){
              var hash = window.location.hash; 
              var el = jQuery(hash);
              if(el.length > 0) {
                  var top = el.offset().top;
                  window.scroll(0, top);        
              }
          });
          
      </script>
      
      <script>
      window.laytheme.on("newpageshown", function(layoutObj, type, obj){
          
        jQuery("body").append('<div class="pointer"></div>');
          jQuery("body").on("mousemove", function(e) {
      	jQuery("nav.laynav .menu-item>a span").css({ top: e.clientY + "px", left: e.clientX + "px" });
      	
      });
      
        });
      </script>
      
      <script>
      jQuery(document).ready(function(){
      jQuery('li.menu-item a').addClass('scrollTo');
      });
      </script>
      

      For the question 3 I am still open to suggestions or any help :)

      Thanks have a great week-end!
      Sofia

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

        @sofiapapa08 said in Submenu anchor not clickable when on another page + on mobile menu !:

        1. Last question : I am here https://www.artefax.ch/services/, when I click on the link of Mike, I want to open automatically the anchor of Mike's profile in "à propos" menu > "musique" submenu > Mike Kundaeli anchor. Is it possible? Otherwise I'll create simple page for each profile. See image below.

        im not sure what u mean "open automatically the anchor of Mike's profile"

        S 1 Reply Last reply
        0
        • arminunruhA arminunruh

          @sofiapapa08 said in Submenu anchor not clickable when on another page + on mobile menu !:

          1. Last question : I am here https://www.artefax.ch/services/, when I click on the link of Mike, I want to open automatically the anchor of Mike's profile in "à propos" menu > "musique" submenu > Mike Kundaeli anchor. Is it possible? Otherwise I'll create simple page for each profile. See image below.

          im not sure what u mean "open automatically the anchor of Mike's profile"

          S Offline
          S Offline
          sofiapapa08
          wrote on last edited by
          #4

          Hi @arminunruh

          When you are on "À propos" page, the row of Mike's profile (with bio+image) is collapsed and you need to click on his name so that it expands.
          So when you are on another page, like "Services" and you click on a link of "Mike", I want it to dedirect on "À propos" page directly on the expanded row of "Mike Kundaeli" profile.

          But I don't know if it is possible?

          Thanks for the answer and have a great week-end :))

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

            oh yea i understand

            mmh i think theres no way to do that at the moment!

            1 Reply Last reply
            0
            • S sofiapapa08

              @sofiapapa08 said in Submenu anchor not clickable when on another page + on mobile menu !:

              jQuery(document).on( 'click', 'a[href^="#"]', function(e){
              e.preventDefault();
              var hash = jQuery(this).attr('href');
              var el = jQuery(hash);
              var top = el.offset().top;
              jQuery('html, body').animate({
              scrollTop: top
              }, 300, 'swing',
              function() {
              window.location.hash = hash;
              }
              );
              } );

              Hi!
              I solved the question 1 and 2 by removing some things in the custom head content, here is my new code

              <script>
                  
                  window.laytheme.on('newpageshown', function(){
                      var hash = window.location.hash; 
                      var el = jQuery(hash);
                      if(el.length > 0) {
                          var top = el.offset().top;
                          window.scroll(0, top);        
                      }
                  });
                  
              </script>
              
              <script>
              window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                  
                jQuery("body").append('<div class="pointer"></div>');
                  jQuery("body").on("mousemove", function(e) {
              	jQuery("nav.laynav .menu-item>a span").css({ top: e.clientY + "px", left: e.clientX + "px" });
              	
              });
              
                });
              </script>
              
              <script>
              jQuery(document).ready(function(){
              jQuery('li.menu-item a').addClass('scrollTo');
              });
              </script>
              

              For the question 3 I am still open to suggestions or any help :)

              Thanks have a great week-end!
              Sofia

              C Offline
              C Offline
              cyrus
              wrote on last edited by
              #6

              @sofiapapa08 Thanks a lot this also helped me solve a similar issue with anchors on mobile.

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

                as far as i understood the issue:

                • on desktop a menupoint has a submenu

                • on mouseover, the submenu is shown, but the menupoint can be clicked too

                • on touchdevices, when the menupoint is clicked, it shows the submenu

                • on touchdevices the menupoint can't be clicked to navigate to its page. clicking it only expands the submenu

                this is by design. on nike.com on touchdevices, they solved it like this:
                for example:
                you click on shoes:

                Screenshot 2023-10-26 at 12.52.29.png

                then the submenu shows and inside it is "all shoes".

                Screenshot 2023-10-26 at 12.52.34.png

                so in the submenu there is another menupoint that would lead you to the page that the parent menupoint is linked to.

                so what i think you could do is:
                in appearance → menus, choose:
                mobile menu

                Screenshot 2023-10-26 at 12.54.41.png

                here, create a mobile menu.
                then add one mobile menu point twice. once as the parent menu item, and once again as the top submenu item:

                Screenshot 2023-10-26 at 12.56.12.png

                this way, the parent mobile menu point is used to extend the submenu when its clicked on. but you can still go to its page, by clicking the same menu point that is within the submenu

                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
                A
                alasdair17
                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