Tagged: x
-
AuthorPosts
-
October 28, 2016 at 12:09 am #1234278
benefacereParticipantHi,
I’m creating a multi page site with some anchor links menu toward homepage sections, and other links menu toward “independant pages”.
See here : http://pyrum.bene-facere.fr/
Menu item 1 : link toward section http://pyrum.bene-facere.fr/#recycling
Menu item 2, 3, 4 : link to sections of homepage
Menu item 5 : independant page
Menu item 6 : popupOn “other independant page than homepage” (like http://pyrum.bene-facere.fr/press/), the anchor menu links (menu item 1,2,3,4) works but the top menu is positionnating a bit lower on the homepage whereas it’s perfect when i click on a anchor menu link on the homepage itself.
Can you help ?
Thanks !
October 28, 2016 at 3:14 am #1234443
Rue NelModeratorHello There,
Thanks for writing in! I can confirm that the placement of the section is different when you are clicking from an independent page. To resolve this, please add the following JS code in the customizer, Appearance > Customize > Custom > Javascript
jQuery( function( $ ) { var hash = window.location.href.split('#')[1]; if ( $('.page').length > 0 && hash !== undefined ) { $( document ).ready( function() { $( '.x-navbar a[href$="#'+ hash +'"]').trigger('click'); }); } });We would loved to know if this has work for you. Thank you.
October 28, 2016 at 3:35 am #1234469
benefacereParticipantThanks for the fast answer.
I have integrated your (very logical !) code and the “click” is well triggered on click back to the homepage ; but i don’t see any difference yet…
Any idea ?
October 28, 2016 at 4:27 am #1234554
LelyModeratorHi There,
Please try updating the code to this:
jQuery( function( $ ) { var hash = window.location.href.split('#')[1]; if ( $('.page').length > 0 && hash !== undefined ) { $( document ).ready( function() { $( '.x-navbar a[href$="#'+ hash +'"]').trigger('click'); }); } });Hope this helps.
October 28, 2016 at 7:59 am #1234720
benefacereParticipantSeems to be the exactly same code
October 28, 2016 at 1:47 pm #1235102
Nabeel AModeratorHi there,
I’ve checked your page and there is a JavaScript error on the page
Uncaught TypeError: event.preventDefault is not a functionPlease navigate to your Appearance > Customize > Custom > Edit Global Javascript and remove this line of code:event.preventDefault();from this code:
jQuery( function( $ ) { var hash = window.location.href.split('#')[1]; if ( $('.page').length > 0 && hash !== undefined ) { $( document ).ready( function(event) { event.preventDefault(); $( '.x-navbar a[href$="#'+ hash +'"]').trigger('click'); }); } });Let us know how this goes!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1234278 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
