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 6977391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:37:11+00:00 2026-05-27T17:37:11+00:00

I am working on this plugin which scrolls an element to show the hidden

  • 0

I am working on this plugin which scrolls an element to show the hidden content.

But I cannot make it right, for instance,

  1. when I scroll the content to reach numbers 7,8 and I want to scroll back one step previous only to reach numbers 5,6 but it scrolls up to reach numbers 1,2.

  2. after it reaches up to numbers 1,2 mistakenly, it scrolls straight down to reach numbers 8,9 when I click the more button again.

How can I fix it?

Here is the plugin code,

(function($){

   $.fn.extend({ 

        scroll_up_down: function(options) {

            var defaults = {
                associateScroller:           '.less',
                scrollTarget:                '.items-thread',
                scrollAmount:                40,
                callback:                     function() {}
            }

            var options =  $.extend(defaults, options);
            var o = options;
            var scroll_amount =  o.scrollAmount;
            var associate_scroller = o.associateScroller


            var $cm = this.click(function(e){

                // Set the varible.
                var object = $(this);
                var scroll_target = $(o.scrollTarget);

                scroll_target.animate({scrollTop:scroll_amount}, 500);

                scroll_amount += o.scrollAmount;


                return false;

            });

            var $cm_2 = $(associate_scroller).click(function(e){

                // Set the varible.
                var scroll_target = $(o.scrollTarget);

                scroll_target.animate({scrollTop:-scroll_amount}, 500);
                scroll_amount -= o.scrollAmount;


                return false;
            });



        }
    });

})(jQuery);
  • 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-27T17:37:12+00:00Added an answer on May 27, 2026 at 5:37 pm

    The problem is the variable scroll_amount. First of all, it always scrolls back to the top because you pass in negative! scroll amount. You don’t want to do that. Second you should modify the scroll amount before the animation rather than after it.

    http://jsfiddle.net/CxbYf/2/

    scroll_amount = ...;
    scroll_target.animate({scrollTop:scroll_amount}, 500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on this html5 file uploader plugin but it has a bug
I am working on a project which used this plugin . I really can't
I am trying to get this awesome JQuery plugin working with SQL Server. I
I have this working great, but I'd like a deeper understanding of what is
Okay so im working on this php image upload system but for some reason
I am working on an Eclipse plugin which uses custom textmarker annotations. There are
I'm working on a Firefox-plugin which searches a webpage for all textareas and places
I'm working on a Firefox plugin which contains a file holding some HTML data.
I am looking to use this plugin: http://keith-wood.name/countdown.html but I need to use the
Following up on this question, I'm working on a large Delphi 7 codebase which

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.