-
AuthorPosts
-
February 27, 2015 at 2:27 pm #403410
Hi there!
I am having troubles with showing the current menu item when it is active. I set one page up with a Full Width Sub Menu Module. On hover functions lovely but with current I have problems.
Can you help?
February 28, 2015 at 10:25 pm #403923March 1, 2015 at 4:03 pm #404072Hey Josue
I did the update but it still looks the same. Maybe I am writing a wrong CSS:
#top .av-subnav-menu > li:hover {
background-color: transparent;
border-bottom: 4px solid #d12a24;
} //THIS WORKS//#top .av-subnav-menu > li > .current-menu-item > a {
background-color: transparent;
border-bottom: 4px solid #d12a24;
} //THIS DES NOT WORK//Can you help?
There is also a strange thing happening as well in the dropdown navigation of main menu. The CSS works fine but menuitems which should be highlighted as current do not respond to the one you are pointing: they are one sector above: e.g. when I navigate to «Hauptgang» the menu «Vorspeisen» is shown as active – very strange. Can you help?
URL: http://roessli.salai.com
Best regards
SafetMarch 1, 2015 at 7:31 pm #404157Hey!
It doesn’t work because the fullwidth submenu items never get the
current-menu-item
class, this is more of a limitation with the current plugin we use for this (scrollSpy), try the following:1. Open js/avia.js and change this line:
$('body').avia_scrollspy({target:'.main_menu .menu li > a'});
To:
$('body').avia_scrollspy({target:'.av-submenu-container .av-subnav-menu li > a'});
2. Also in js/avia.js change:
offset: (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) + ($(".html_header_sticky #header_main_alternate").outerHeight()) + ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) + 1 + parseInt($('html').css('margin-top'),10),
To:
offset: (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) + ($(".av-submenu-container").outerHeight()) + ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) + 1 + parseInt($('html').css('margin-top'),10),
Your second CSS code should be like this:
#top .av-subnav-menu > li.current-menu-item { background-color: transparent; border-bottom: 4px solid #d12a24; }
Cheers!
Josue- This reply was modified 9 years, 2 months ago by Josue.
February 10, 2016 at 6:21 pm #581293Hi Josue,
I made this change in the avia.js and works great, when I cross the ID scrolling the page the corresponding item in the submenu highlight as I wanted. The only bug I see is when I scroll to a different part of the page, the highlighted item still active except if an other ID corresponds to a submenu item. What I want is to disable the active mode if I am not in that area of the page. I hope you understand me. My english skills is not my best.
Regards,
- This reply was modified 8 years, 9 months ago by Helchar.
February 11, 2016 at 6:21 pm #581800Hi,
Can you post the link to your website please?
Regards,
JosueFebruary 15, 2016 at 1:02 pm #583349Hi Josue,
I post the link in the Private Content.Regards,
Carlos.February 15, 2016 at 10:32 pm #583796Hi!
To highlight the fullwidth submenu on same page while scrolling please add the below code to functions.php file
//One page nav highlight function activateMenuItem(){ ?> <script> jQuery(document).scroll(function() { var sections = jQuery('.avia-section'), menu = jQuery('.av-submenu-container'), nav_height = menu.outerHeight(); jQuery(window).on('scroll', function() { var cur_pos = jQuery(this).scrollTop(); sections.each(function() { var top = jQuery(this).offset().top - 300, bottom = top + jQuery(this).outerHeight(); if (cur_pos >= top && cur_pos <= bottom) { menu.find('a').removeClass('active-menu-item'); menu.find('a[href="#' + jQuery(this).attr('id') + '"]').addClass('active-menu-item'); } }); }); }); </script> <?php }
Then add your own highlight style
/* Your css styles for active menu item*/ .current_page_item .avia-menu-text, .active-menu-item { background:gold!important; }
Cheers!
Vinay Kashyap- This reply was modified 8 years, 9 months ago by Vinay.
February 16, 2016 at 10:54 am #584043Hi Vinay,
I tried your code and does not work .
I returned to the previous method changing avia.js as Josue say. This works fine, but does not disable the menu item when I’m not in that IDRegards,
Carlos
February 17, 2016 at 1:17 pm #584671Hi!
This line:
offset: (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) + ($(".av-submenu-container").outerHeight()) + ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) + 1 + parseInt($('html').css('margin-top'),10),
Change it to:
offset: (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) + ($(".av-submenu-container").outerHeight()) + ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) + 1 + 51 + parseInt($('html').css('margin-top'),10),
Cheers!
JosueFebruary 17, 2016 at 1:44 pm #584701Hi Josue!
I applied your code but it doesn’t work :(.
If you go for example to “Sample Itinerary” and then scrolls back to the top of the page, the submenu item “Sample Itinerary” stays highlighted.Any help?
Regards,
CarlosFebruary 17, 2016 at 2:47 pm #584752Hi,
Can you please create us a temporary FTP / SFTP account? post it here as a private reply.
Regards,
JosueFebruary 17, 2016 at 5:32 pm #584858Hi Josue,
I post you a temporary FTP account in the private content.
Regards,
CarlosFebruary 18, 2016 at 4:46 pm #585494Hey!
Can you check it now? it seems to be working.
Note: i moved js/avia.js to the child theme install.
Cheers!
JosueFebruary 18, 2016 at 4:58 pm #585499Hi Josue!
I don’t see the changes :(
“Sample Itinerary” stays highlighted when I scroll up to the top of the page.
Cheers!
CarlosFebruary 18, 2016 at 5:32 pm #585522Hm, can you hand me a temporary WordPress Administrator access?
Regards,
JosueFebruary 18, 2016 at 9:07 pm #585691Off course Josue, I really appreciate your help!
Post it on Private Content.Regards,
Carlos- This reply was modified 8 years, 9 months ago by Helchar.
February 18, 2016 at 9:19 pm #585701Ok check it now, i added a fix using a menu item pointing to the previous section and hiding it with CSS.
Regards,
JosueFebruary 18, 2016 at 10:13 pm #585743Great Job!
Thank you!!!Can you tell me which lines of code do you modify? I do not want to overwrite it in Future Updates.
This is your CSS code?
.av-subnav-menu > li:first-child {
display: none !important;
}The other file it´s the shortcodes.js? which line?
Regards,
Carlos- This reply was modified 8 years, 9 months ago by Helchar.
February 18, 2016 at 11:05 pm #585787I didn’t modify any JS file, the fix was:
1. Add a new menu item pointing to the section before “itinerary”.
2. Hide this menu item with CSS (style.css).Also, you don’t have to worry about updates because i moved the js files to your child theme.
Cheers!
JosueFebruary 18, 2016 at 11:56 pm #585799Haaa, Ok! You did it manually.
I thought you created a code so that the first item of the submenu were generated dynamically on each page.Good idea!
Thank you very much!!!!Eres el mejor : )
Cheers!
CarlosFebruary 19, 2016 at 5:26 am #585839De nada :)
Saludos,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.