Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1342040

    Every menu item we click will load the page. After that the menu link is prepend with #top
    This is a not wanted feature how can this be removed/ adjusted?

    This prevents reloading the same page after a new click but thats is just what we want to happen in our case.

    Regards,

    Aren

    #1342056

    Hey Aren,

    Thanks for contacting us!

    Please copy enfold/js/avia.js to your child theme inside /js/ folder, open the file and find following line

    matching_link = this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top');

    and comment it out as following

    // matching_link = this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top');

    Then add following code to functions.php file of your child theme

    function wp_change_aviajs() {
    wp_dequeue_script( 'avia-default' );
    wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true );
    }
    add_action( 'wp_print_scripts', 'wp_change_aviajs', 100 );

    Best regards,
    Yigit

    #1342063

    Ok thanks.

    I had to change the two lines where matching_link a part from is to:

    var current = window.location.href;

    And then it worked.

    Thanks,

    Aren

    #1342064

    Hi Aren,

    You are welcome! Thanks for sharing your solution :)

    Let us know if you have any other questions and enjoy the rest of your day!

    Best regards,
    Yigit

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘#top anchor added to the main menu items’ is closed to new replies.