• Hi! I have exactly this structure on my page and using the wonderful “Page scroll to id” plugin for a kinda spyscroll effect.

    In this case, I have nested anchors: #parent_section -> #sub_section.

    Everything works great, but nested links (#sub_section) are not highlighted with mPS2id-highlight class immidiately… It takes a few miliseconds.

    I don’t quite understand why. Can I somehow get rid of this small delay?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    The delay you see comes from another script in your theme. I think it comes from this js:

    ...themes/ohio/assets/js/main.js

    I don’t know if you can manually add a script in your theme(?) but you can try this:

    Edit your theme/child-theme footer.php and add the following before the closing body tag (</body>):

    
    <script>
    (function($){
        $(window).on("load",function(){
            if($('.spyscroll-menu').length){
                setTimeout(function(){
                    var events = $._data(window, 'events');
                    for (var i = events.scroll.length - 1; i >= 0; i--) {
                        if(!events.scroll) return;
                        var handler = events.scroll[i];
                        if (handler && handler.namespace != 'mPS2id') {
                            $(window).off('scroll');
                        }
                    }
                },300);	
            }
        });
    })(jQuery);
    </script>

    Save/update the file and test your page.

    I can’t really say if the above will cause any conflict with other functionalities, but it should improve the highlight delay issue.

    Hope this helps

    Edit: Added the script tags in the code above

    • This reply was modified 4 years, 7 months ago by malihu.
Viewing 1 replies (of 1 total)
  • The topic ‘Nested # anchor’ is closed to new replies.