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

  • SEARCH
  • Home
  • 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 6711089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:05:54+00:00 2026-05-26T08:05:54+00:00

Found this code on the net. Want to modify it to make it scroll

  • 0

Found this code on the net. Want to modify it to make it scroll a div continously when the mouse button is down and stop scrolling when the mouse button is up. I tried this:

  • Change from the click event to the mousedown event. That did not do it.
  • Added a call to the same function within the function. That did not do it either.

What should I modify in this function to have the continous scrolling on mouse down?

(function ($) {
    var vscrollid = 0;
    $.fn.vScroll = function (options) {
        var options = $.extend({}, { speed: 500, height: 300, upID: "#up-arrow", downID: "#bottom-arrow", cycle: true }, options);

        return this.each(function () {
            vscrollid++;
            obj = $(this);
            var newid = vscrollid;

            obj.css("overflow", "hidden");
            obj.css("position", "relative");
            obj.css("height", options.height + "px");
            obj.children().each(
                function (intIndex) {
                    $(this).addClass("vscroll-" + vscrollid + "-" + intIndex);
                });


            var itemCount = 0;

            $(options.downID).click(function () {
                var nextCount = itemCount + 1;
                if ($('.vscroll-' + newid + '-' + nextCount).length) {
                    var divH = $('.vscroll-' + newid + '-' + itemCount).outerHeight();
                    itemCount++;
                    $("#vscroller-" + newid).animate({
                        top: "-=" + divH + "px"
                    }, options.speed);
                }
                else {
                    if (options.cycle) {
                        itemCount = 0;
                        $("#vscroller-" + newid).animate({
                            top: "0" + "px"
                        }, options.speed);
                    }
                }
            });

            $(options.upID).click(function () {
                var prevCount = itemCount - 1;
                if ($('.vscroll-' + newid + '-' + prevCount).length) {
                    itemCount--;
                    var divH = $('.vscroll-' + newid + '-' + itemCount).outerHeight();
                    $("#vscroller-" + newid).animate({
                        top: "+=" + divH + "px"
                    }, options.speed);
                }
            });

            obj.children().wrapAll("<div style='position: relative; top: 0' id='vscroller-" + vscrollid + "'></div>");
        });

    };

})(jQuery);

/*
* jQuery vScroll
* Copyright (c) 2011 Simon Hibbard
* 
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:

* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. 
*/

/*
* Version: V1.2.0
* Release: 10-02-2011
* Based on jQuery 1.4.2
*/
  • 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-26T08:05:54+00:00Added an answer on May 26, 2026 at 8:05 am

    Was able to get the continuous scrolling with simpler code.

        <script type="text/javascript"> 
                    $(document).ready(function($) {
                       $(".scrolling_prev", $("#'.$node['ID'].'")).mousedown(function() {
                            startScrolling($(".link_drop_box", $("#'.$node['ID'].'")), "-=50px");
                        }).mouseup(function() {
                            $(".link_drop_box", $("#'.$node['ID'].'")).stop()
                        });
                        $(".scrolling_next", $("#'.$node['ID'].'")).mousedown(function() {
                            startScrolling($(".link_drop_box", $("#'.$node['ID'].'")), "+=50px");
                        }).mouseup(function() {
                            $(".link_drop_box", $("#'.$node['ID'].'")).stop();
                        });
                    });
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just found this code in reflector in the .NET base libraries... if (this._PasswordStrengthRegularExpression
I've found this snippet of code on the net. It sets up an NSMutableArray
I found the code from the net in which i cant understand this line:-
I found this code from http://kevin.vanzonneveld.net/techblog/article/convert_anything_to_tree_structures_in_php/ , but I couldn't get it work. I
i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
I found this code using Google. private int RandomNumber(int min, int max) { Random
I found this code for alphanumeric check (Letters, numbers, spaces or underscores) but I
i found this code at activestate, it takes a string and prints permutations of
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I found this code here class Usable; class Usable_lock { friend class Usable; private:

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.