• I was looking to use this plugin in my theme that has a floating menu and came across a problem when after posting the comment the page scrolls to the anchor, however since I have a floating menu on top the anchor scrolls below the floating menu.
    I do see the option for Disable Scroll to anchor, however I don’t want to disable it… i like that the new comment is visible to the user.

    Is there a way to tell the plugin to scroll to the anchor but with an offset so that its clear of the floating menu.
    Better still would be if it could scroll right into the center of the viewport, and maybe have a small animation indicating that its the newest comment in the thread.

    the default design of the plugin works well when there’s just one or two levels of comments, however if there are a lot of levels of a lot of large sized comments its very confusing to the end user. Any help would be greatly appreciated.

    https://wordpress.org/plugins/wp-ajaxify-comments/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter K B

    (@kiritb)

    Here is a possible answer to my question.
    http://pixelflips.com/blog/anchor-links-with-a-fixed-header

    I tried doing this on OnAfterUpdateComments

    jQuery(document).ready(function($) {
       this.prepend( "<span class=\"new-comment-anchor\" id=\"nwcmt\"></span>" );
    });

    and added this css
    .new-comment-anchor{ display: block; height: 115px; margin-top: -115px; visibility: hidden;}

    but that doesn’t seem to do it.
    Any ideas?

    Thread Starter K B

    (@kiritb)

    Ok so I tried a variety of settings with the span anchor options (as indicated in my previous message) but none of them worked.

    I’m seeing in wp-ajaxify-comments.js in the function WPAC._ScrollToAnchor
    it seems to be using var scrollTargetTopOffset = anchorElement.offset().top
    to get an offset by which it should scroll to. However I can’t figure out how to set that offset.

    I also noticed that the anchor that goes into the function is directly for the comment div tag e.g. id=comment-101
    however my comment typically has the username/datetimestamp etc above the comment div tag and ideally I’d want to scroll to that particular element.

    help please! alternatively does anyone know of another plugin that might be more suited to what i’m looking for.

    Just try to add the HTML elements described here http://pixelflips.com/blog/anchor-links-with-a-fixed-header your theme. This should be much easier than using the plugin’s callback options.

    If this does not help: Please send me a link to your page where I can reproduce the problem.

    Hope this helps…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Scroll to anchor problem with floating menu’ is closed to new replies.