Submenu anchor not clickable when on another page + on mobile menu !
-
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.
A bit urgent cause I need to present the website on tuesday 😰 If someone could help me before that, would be incredible ❤️
Thanks a lotSofia
-
@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 -
@sofiapapa08 said in Submenu anchor not clickable when on another page + on mobile menu !:
- 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"
-
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 :))
-
oh yea i understand
mmh i think theres no way to do that at the moment!
I don't answer or check forum DMs, please just post on the forum.
Before you post:
Use the Search Feature. Maybe there is already a solution to your issue.
1. Update Lay Theme and all Lay Theme Addons
2. Disable all Plugins
3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
4. When using a WordPress Cache plugin, disable it or clear your cache.
Now see if your problem solved itself.
Go here, see if your problem is listed here:
Troubleshooting
When you post:
1. Post a link to where the problem is
2. If the problem is difficult to explain, post screenshots / link to a video to explain it