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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:59:10+00:00 2026-06-13T18:59:10+00:00

I want to add keyboard control for the tiny scrollbar script. i am not

  • 0

I want to add keyboard control for the tiny scrollbar script. i am not very good at javascript. i know that i can use jquery keypress() function to intercept arrow keys(38,40) and then scroll the overview div by changing its css top property.

I can do this outside of the tinyscrollbar plugin but i would love to use the functions that is already inside the plugin to do that.

Any direction on how to start this will be a big help.thanks.

for more information, check tinyscrollbar code here. And more info and demos here.

  • 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-06-13T18:59:11+00:00Added an answer on June 13, 2026 at 6:59 pm

    I added a new function to the plugin and used it to update scroll on keydown event.

    Code added to the plugin:

    // define the added function
     jQuery.fn.tinyscrollbar_updatescroll = function(sScroll)
    {
        return jQuery( this ).data( 'tsb' ).updatescroll( sScroll ); 
    };
    // end of added function definition
    
    function Scrollbar( root, options )
    {
        var oSelf       = this
        ,   oWrapper    = root
        ,   oViewport   = { obj: jQuery( '.viewport', root ) }
        ,   oContent    = { obj: jQuery( '.overview', root ) }
        ,   oScrollbar  = { obj: jQuery( '.scrollbar', root ) }
        ,   oTrack      = { obj: jQuery( '.track', oScrollbar.obj ) }
        ,   oThumb      = { obj: jQuery( '.thumb', oScrollbar.obj ) }
        ,   sAxis       = options.axis === 'x'
        ,   sDirection  = sAxis ? 'left' : 'top'
        ,   sSize       = sAxis ? 'Width' : 'Height'
        ,   iScroll     = 0
        ,   iPosition   = { start: 0, now: 0 }
        ,   iMouse      = {}
        ,   touchEvents = 'ontouchstart' in document.documentElement
        ;
    
        function initialize()
        {
            oSelf.update();
            setEvents();
    
            return oSelf;
        }
    
        // the new added function using the wheel function
        this.updatescroll = function( sScroll )
        {
            if( oContent.ratio < 1 )
            {
    
                iScroll -= sScroll;
                iScroll = Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll ));
    
                oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
                oContent.obj.css( sDirection, -iScroll );
    
            }
        };
        // end of added function
    

    the code outside the plugin:

    jQuery('body').keydown(function (event) {
        if (event.keyCode == 38) {
          // up arrow
          $('#scrollbar1').tinyscrollbar_updatescroll(40);
        } else if (event.keyCode == 40) {
         // down arrow
         $('#scrollbar1').tinyscrollbar_updatescroll(-40);
        }
      });
    

    the tinyscrollbar_updatescroll scrolls the content to the current position plus the amount sent to it. the original tinyscrollbar_update function scrolls the content to a certain position given in pixels.

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

Sidebar

Related Questions

On Android devices that use soft keyboards, I want to prevent the fullscreen keyboard
I want to add a accessoryView on a keyboard called from a UISearchBar. Since
I have a list of string values that I want add to a hashtable
I have numbers in javascript from 01(int) to 09(int) and I want add 1(int)
I want to add time in my textfield and for that as per client's
I am doing a my own number keyboard. I want to add clear button
I want to add the smilies in the keyboard for text to add the
I want add a UIToolbar to the keyboard for my UITextField . Here is
How can I add keyboard shortcuts to a Java applet? I had an assignment
How can I add custom commands to the keyboard dialog (Tools->Options->Keyboard) in order to

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.