• I’ve been having what seems to be the same issue as the topic linked below, although not Avada theme…

    https://wordpress.org/support/topic/jump-anchors-need-adjusting-avada-theme/

    I can see that a fix has been implemented and included with the plugin, but to the best of my knowledge ‘a-z-listing/scripts/a-z-listing-scroll-fix.js’ is not loaded in any way, so anchor links are doing their default of jumping to the top of the window.

    Have tried enqueueing it myself, however I have limited knowledge. Any assistance, or an update of the plugin would be greatly appreciated.

    Thanks 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter culcram

    (@culcram)

    Was I right in thinking that this is already part of the plugin and just not loaded in any way?

    If so, it would be great to get a fix asap. It’s one thing that a client (and my boss continue to mention!

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The script is present in the plugin as an example. It will need customisation to support each site. You can load it without customising it with the following in your theme’s functions.php:

    add_action( 'wp_enqueue_scripts', 'enqueue_a_z_scroll_fix' );
    function enqueue_a_z_scroll_fix() {
        wp_enqueue_script( 'a-z-scroll-fix', plugins_url( 'scripts/a-z-listing-scroll-fix.js', trailingslashit( WP_PLUGINS_DIR ) . 'a-z-listing/a-z-listing.php' ), array(), false, true );
    }

    The best thing to do, however, is to copy the file into an appropriate location in your theme, add any customisations – you likely need to adjust the offset, and then load from there instead of from the plugin.

    • This reply was modified 6 years, 1 month ago by Dani Llewellyn. Reason: Fix wp_enqueue_script() usage
    Thread Starter culcram

    (@culcram)

    Thanks. Although I had to amend it to the below:

    trailingslashit( WP_CONTENT_DIR ) . '/plugins/a-z-listing/a-z-listing.php'

    Can the offset be included on the Back to top links in any way??

    Plugin Author Dani Llewellyn

    (@diddledani)

    To apply to the back-to-top links you’ll need to modify the javascript to also target those links.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Anchor offset’ is closed to new replies.