Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 616903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:22:36+00:00 2026-05-13T18:22:36+00:00

I’m using jquery to display/hide my comments on my blog. I show a bubble

  • 0

I’m using jquery to display/hide my comments on my blog. I show a bubble besides the title of the post displaying number of comments. On clicking that bubble, the comments show up at the bottom of the post.

My problem is, if the post is long(which they usually tend to be), the user has no clue there’s a comment section popped up below the post. Is there some way to proceed to this comments section at the bottom of the post? I’m using the toggle function like so:

var $j = jQuery.noConflict();
        $j(".post-comments").addClass("hidden"); //hide all comments on page
        $j(".post-comments-count").toggle(
              function () {
                    $j(this).parent().parent().find(".post-comments").removeClass("hidden");
                    /* alert('should slide down');
                    $j(this).parent().parent().find(".post-comments").slideDown("slow");*/
              },
              function () {
                    $j(this).parent().parent().find(".post-comments").addClass("hidden");
                    /* alert('should slide up');
                    $j(this).parent().parent().find(".post-comments").slideUp("slow"); */
              }
        );

Couple of things:

  • I suppose one solution would be to add a #link suffix to the bubble’s anchor tag? the issue however would be on clicking it again, it wouldn’t exactly work too well in closing the comments section?
  • Yes I’m aware that once you open it up, you can only close the comments section again by clicking the bubble on top, which most people won’t bother doing. Nevertheless, i’m willing to live with that.

(not directly related)

  • I’ve commented the slide-down function because for some bl**dy reason my jquery conks off when in wordpress and doesn’t slide back up. Hence the straight forward addition and removal of classes.
  • If you want a live example, you’re welcome to check it out at my blog: kaushikgopal.com/blog
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:22:36+00:00Added an answer on May 13, 2026 at 6:22 pm

    The simple way to accomplish the scroll you’re talking about (including a smooth animation) is with the code below:

    var comment_div = $j(this).parent().parent().find(".post-comments");
    comment_div.removeClass("hidden");
    
    var targetOffset = comment_div.offset().top;
    $j('html,body').animate({scrollTop: targetOffset}, 1000);
    

    The first part obviously is just a rewrite of your existing class change, but also stores the reference to the comment DOM element that you just un-hid.

    The second part calculates the vertical offset from the top of the HTML body to the top of the comments div. Then it scrolls the page to that offset position, animated over 1sec (or 1000msec). By adjusting the targetOffset value, you can adjust where on the screen the user gets scrolled to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
In order to apply a triggered animation to all ToolTip s in my app,
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.