Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1237552
    tituweb
    Participant

    Hi, i want to active menu-active option on http://sinhafwl.com/sfl how to do I’ve tried with https://community.theme.co/kb/how-to-setup-one-page-navigation/ this. but i can’t

    #1237564
    Lely
    Moderator

    Hi There,

    Please try adding this code on Appearance > customize > Custom > Edit Global Javascript:

    jQuery(document).ready(function($) {
        
         /**
         * This part handles the highlighting functionality.
         * We use the scroll functionality again, some array creation and 
         * manipulation, class adding and class removing, and conditional testing
         */
        var aChildren = $("nav li").children(); // find the a children of the list items
        
        var aArray = []; // create the empty aArray
        for (var i=0; i < aChildren.length; i++) {    
            var aChild = aChildren[i];
            var ahref = $(aChild).attr('href');
            aArray.push(ahref);
            //alert(ahref);
        } // this for loop fills the aArray with attribute href values
    
        $(window).scroll(function(){
            var windowPos = $(window).scrollTop(); // get the offset of the window from the top of page
            var windowHeight = $(window).height(); // get the height of the window
            var docHeight = $(document).height();
    
            for (var i=0; i < aArray.length; i++) {
                var theID = aArray[i];
                var divPos = $(theID).offset().top;// get the offset of the div from the top of page
                divPos = divPos - 135; // fix for header hight and padding. In our case 90px+45px
                var divHeight = $(theID).height(); // get the height of the div in question
                divHeight = divHeight +90;// correction for our previous fix so that end of div is calculated properly. This is height of fixed header
                if (windowPos >= divPos && windowPos < (divPos + divHeight)) {
                    $("a[href='" + theID + "']").parent().addClass("current-menu-item");
                } else {
                    $("a[href='" + theID + "']").parent().removeClass("current-menu-item");
                }
            }
        });
        
    });

    Hope this helps.

    #1237695
    tituweb
    Participant

    No Change

    #1237697
    tituweb
    Participant
    This reply has been marked as private.
    #1237746
    Paul R
    Moderator
    This reply has been marked as private.
    #1237900
    tituweb
    Participant

    Hi,

    This is awesome ……. thank you very much what was the problem i need to activate it more two sites as well.

    #1237938
    Joao
    Moderator

    Glad to hear it,

    Joao

    #1239382
    tituweb
    Participant

    Hello dear, I need to add menu active option for those sites sinhafwl.com/skil and sinhafwl.com/skdil, which is you already did for me on sinhafwl.com/sfl. can you please tell me what is the procedure to active it.

    #1239465
    Nabeel A
    Moderator

    Hi again,

    I tried to check both of your sites sinhafwl.com/skdil and sinhafwl.com/skil but they are not loading on my end, can you please double check the URL?

    Thanks!

    #1240268
    tituweb
    Participant
    #1240454
    Paul R
    Moderator

    Hi,

    Please make sure you have selected your menu in the one page dropdown under page settings.

    http://screencast.com/t/TpT1HuiYfhx

    https://community.theme.co/kb/how-to-setup-one-page-navigation/

    Thanks

  • <script> jQuery(function($){ $("#no-reply-1237552 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>