Tagged: menu
-
AuthorPosts
-
November 26, 2020 at 10:53 am #1263225
Hi
I created a single page conference website with Enfold: https://sinnvoll-fuehren.com/hlg/
The problem I have is that the menu indicator (line below menu entry) is not showing where we are on the page. Even when I move with the menu, it shows up on different places. E.g. I press “Sessions” and the bar appears under “Sponsors”. I cannot even determine a pattern where it goes. Sometimes it is even right :)Any hints and suggestions?
Cheers,
RalphNovember 30, 2020 at 4:28 pm #1264014Hey Ralph,
Thanks for contacting us and sorry for the late reply!
I see that you have given the ID to column element in Sessions section. Please edit your Color Section element and give the ID to it instead. The same applies for “Venues” and “Join” sections as well. That should help :)
Best regards,
YigitNovember 30, 2020 at 8:30 pm #1264056Thanks, Yigit. I added some more color sections to set the ID there, so each menu item is a color section. It works a bit better. However, when selecting Venue it underlines Hotel, Hotel => Team, Team => Sponsors.
Best regards,
RalphDecember 1, 2020 at 10:20 am #1264166Hi,
Have you figured it out already because currently it highlights correct section on my end. I attached screenshots in private content field below :)
Best regards,
YigitDecember 4, 2020 at 10:36 am #1264967Wow – to me this looks different. Screenshots attached on private field. I cleared the page cache and I used the private mode of the browser.
December 7, 2020 at 2:53 pm #1265485Hi,
What is your screensize and are you seeing the issue on all 3 browsers? I would say it is cache related but if you are seeing the issue on all browsers then it might be related to your screen size I believe :)
Best regards,
YigitDecember 7, 2020 at 6:17 pm #1265544Hi Yigit,
wow – it is a screen-size problem indeed. When I make the browser window smaller, the problem disappears.
Hmmm – since I cannot control the screen size of the users, I find this peculiar. How can this be fixed?Cheers,
Ralph- This reply was modified 3 years, 11 months ago by Ralph.
December 13, 2020 at 9:25 pm #1266944Hi,
Sorry for the very late reply and thanks for the links. Please check the map image in the #venue section, it is not showing because the background image URL is not correct, also please disable any lazy loading, I believe the image heights are not applied until the images are viewed so when jumping to the anchor the image heights seem to be changing the section heights.Best regards,
MikeDecember 14, 2020 at 6:51 pm #1267239Hi Mike
I’m puzzled. There is no background image set for that container. The URL you show me is the default of the OpenStreetMap Plugin. The map itself is displayed. The map height is 450px. Should I set a fixed minimum section height? I also have problems to reproduce the issue… On an even larger screen, it shows correctly now.
Hmmmm…
Cheers,
RalphDecember 17, 2020 at 2:12 pm #1268127Hi,
Sorry for the late reply, I find that the OpenStreetMap image is not showing for me, I only see an empty box, do you have any lazy loading plugins, or any caching or minifying plugins with a lazy loading option? Since the box seems to be holding it’s height without the image showing for me, this is probably not the cause I first thought it was.
I also found that if you go to #join (tickets) and then #venue, back and forth, the highlighting seems fine until you go to #hotel, or if you go to #hotel first.
Do you have sections with the same ID for different widths? Such as one #venue for mobile and one for desktop, thus having two sections with the same ID?
Can I login with an admin login and investigate further? Is this a “live” site, can I test some changes, deactivate plugins & scripts, if I restore them back?Best regards,
MikeDecember 20, 2020 at 9:47 pm #1268875This reply has been marked as private.December 23, 2020 at 4:09 am #1269424Hi,
Thank you for the info.
As Mike observed, it seems to be an issue with the lazy loading, so we disabled WP Rocket’s lazy loading option to make sure that the the images are automatically loaded and that the height of the section are properly calculated. Please remove the browser cache or do a hard refresh before testing the page again.
Best regards,
IsmaelDecember 23, 2020 at 9:53 am #1269487Hi Ismael
thanks for finding that out. Unfortunately, the page load is now much worse than before. So, are there other options?
Cheers,
RalphDecember 26, 2020 at 8:04 pm #1269831Hi,
Sorry for the late reply, I tried setting min heights for the color sections that contain plugin shortcodes, without success.
I note the menu highlighting seems fine until “Venue” and then all menu items after are offset by one.
I also see that you are getting an error in the browser console because your child theme functions.php is pointing to a fileavia-snippet-sticky-header.js
that doesn’t exist with this:add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 ); function wp_change_sticky_header_script() { wp_deregister_script( 'avia-sticky-header' ); wp_enqueue_script( 'avia-sticky-header-child', get_stylesheet_directory_uri().'/js/avia-snippet-sticky-header.js', array('avia-default'), $vn, true); } add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1); function avia_include_shortcode_template($paths){ $template_url = get_stylesheet_directory(); array_unshift($paths, $template_url.'/shortcodes/'); return $paths; }
I commented this out as you don’t have a child theme
/shortcodes/
directory, nor an/js/
directory.
Then I added this code as a workaround:function custom_script() { ?> <script> (function($){ $(document).ready(function(){ $.fn.isInViewport = function () { let elementTop = $(this).offset().top; let elementBottom = elementTop + $(this).height(); let viewportTop = $(window).scrollTop(); let viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; }; $(window).scroll(function () { if ($('#venue').isInViewport()) { $('li#menu-item-138').addClass("current-menu-item"); $('li#menu-item-139').removeClass("current-menu-item"); } else { $('li#menu-item-138').removeClass("current-menu-item"); } if ($('#hotel').isInViewport()) { $('li#menu-item-139').addClass("current-menu-item"); $('li#menu-item-138').removeClass("current-menu-item"); $('li#menu-item-140').removeClass("current-menu-item"); } else { $('li#menu-item-139').removeClass("current-menu-item"); } if ($('#team').isInViewport()) { $('li#menu-item-140').addClass("current-menu-item"); $('li#menu-item-139').removeClass("current-menu-item"); $('li#menu-item-141').removeClass("current-menu-item"); } else { $('li#menu-item-140').removeClass("current-menu-item"); } if ($('#sponsors').isInViewport()) { $('li#menu-item-141').addClass("current-menu-item"); $('li#menu-item-140').removeClass("current-menu-item"); } else { $('li#menu-item-141').removeClass("current-menu-item"); } }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
This seems to be working well for desktop, please clear your browser cache and check.
Best regards,
MikeJanuary 5, 2021 at 12:52 pm #1270383Dear Mike
Thanks so much for the detailed analysis and solution. I moved the missing files back to their place. I moved the files back into their place. Those came from a different thread here on adjusting the sticky header.
As far as I understand your script, the current-menu-item is set manually to reflect accurately the position. Thanks for this idea. As far as I can see, that seems to work.
Best regards,
RalphJanuary 7, 2021 at 4:54 am #1270761 -
AuthorPosts
- You must be logged in to reply to this topic.