Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1325561

    Hello,

    I found your post : https://kriesi.at/documentation/enfold/example-of-active-submenu-highlight/
    I did the same to my website, but it only works for the first submenu item. The first item always stays highlighted when i scroll below, till the bottom of the page.
    I have the right anchors in the sub menu (it scolls correctly when clicked). I put the CSS you propose, ans the JS on this page.
    I join you screenshots (I’m currently working in local so i can’t send you the website).
    Can you help me please, and make the highlight work on every section ?
    Thanks,
    Simon G

    #1325739

    Hey Simon,

    Thanks for contacting us!

    Could you please try adding the code under JS into the bottom of Functions.php file in Appearance > Editor

    // Highlight one page nav
    
    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('li').removeClass('active-menu-item');                    
                        menu.find('a[href="#' + jQuery(this).attr('id') + '"]').parent('li').addClass('active-menu-item');
                    }
                });
            });
        });
     
    </script>
    <?php
    }
    add_action('wp_head', 'activateMenuItem');

    If that does not help, please create temporary admin logins, post them here privately and point out the page you are working on so we can look into it :)

    Best regards,
    Yigit

    #1326840

    Hello,
    It is still not working. I send you admin codes and the pages where we want to do it.
    Thanks for your help

    #1326981

    Hi,

    Thank you for the update.

    The script is not working properly because you are not using the color section element. You have to use the color section to divide the content and specify the section name in the Advanced > Developer Settings > Custom ID field.

    If you do not want to change layout or use color sections, try to look for this line in the script..

    var sections = jQuery('.avia-section'),
    

    .. and replace it with:

    var sections = jQuery('.iconbox'),
    

    Best regards,
    Ismael

    #1327021

    Thanks a lot.
    I finally got it !
    On the one hand I didn’t use the color section element as you said, on the other hand i used av-submenu-container instead of the onepage-submenu !
    That CSS did the trick :
    #top .av-submenu-container .active-menu-item,
    #top .av-submenu-container .active-menu-item a {
    background: #000 !important;
    color: #FFF !important;
    }

    #top .av-submenu-container .av-subnav-menu > li > a {
    border-left-style: none !important;
    border-left-width: 0px !important;
    }

    Best regards
    Simon

    #1327102

    Hi,
    Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Active submenu highlight’ is closed to new replies.