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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:28:35+00:00 2026-06-11T22:28:35+00:00

I developped a code including a table with all its cells as droppable. The

  • 0

I developped a code including a table with all its cells as droppable. The table container is div with a fix height and a scrollbar.

I would like drag an element (yellow square in my example) into the last table cell at the bottom of my table. Everything works fine, but to activate the scrollbar of my div container when I am dragging the element, I must move the mouse all the time.

Is there a possibility to scroll down automatically when my element is dragging near the bottom of my div container without moving mouse?

Here is my example : http://jsbin.com/upunek/19/edit

Thanks in advance

  • 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-11T22:28:36+00:00Added an answer on June 11, 2026 at 10:28 pm

    I figure it out this morning.

    I created setInterval function when the drag event position is located at 70px of the border

    Here is the fiddle I made : http://jsfiddle.net/pPn3v/22/

    var yellow = $('#yellow');
    var offset = yellow.offset();
    var offsetWidth = offset.left + yellow.width();
    var offsetHeight = offset.top + yellow.height();
    
    var red = $('#red');
    
    var intRightHandler = null;
    var intLeftHandler = null;
    var intTopHandler= null;
    var intBottomHandler= null;
    var distance = 70;
    var timer = 100;
    var step = 10;
    
    
    function clearInetervals()
    {
        clearInterval(intRightHandler);
        clearInterval(intLeftHandler);
        clearInterval(intTopHandler);
        clearInterval(intBottomHandler);    
    }
    
    red.draggable({
        start : function(){},
        stop: function(){clearInetervals(); },    
        drag : function(e){
            var isMoving = false;        
            //Left
            if((e.pageX - offset.left) <= distance)
            {
                isMoving = true;
                clearInetervals();            
                intLeftHandler= setInterval(function(){
                    yellow.scrollLeft(yellow.scrollLeft() - step)
                },timer);
                console.log('left')
            }
    
            //Right
            if(e.pageX >= (offsetWidth - distance))
            {
                isMoving = true;
                clearInetervals();            
                intRightHandler = setInterval(function(){
                    yellow.scrollLeft(yellow.scrollLeft() + step)
                },timer);
                console.log('right')
            }
    
            //Top
            if((e.pageY - offset.top) <= distance)
            {
                isMoving = true;
                clearInetervals();            
                intTopHandler= setInterval(function(){
                    yellow.scrollTop(yellow.scrollTop() - step)
                },timer);
                console.log('top')
            }                          
    
            //Bottom
            if(e.pageY >= (offsetHeight - distance))
            {
                isMoving = true;
                clearInetervals();            
                intBottomHandler= setInterval(function(){
                    yellow.scrollTop(yellow.scrollTop() + step)
                },timer);
                console.log('bottom')
            }     
    
            //No events
            if(!isMoving)
               clearInetervals();  
        }
    });
    

    ​

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

Sidebar

Related Questions

I would like to automatically determine all of the properties (including the hidden ones)
i tried for including external page in div in my home page but the
I would like to use Real-time Location Tracking geoloqi platform for developers, I didn't
I have activated the google API console https://code.google.com/apis/console and I've created a project, including
What is the general developer opinion on including javascript code on the file instead
I need help figuring out how to successfully redirect while including Analytics code. I
I have developed code on a m-file script in Matlab that communicates with a
I've developed some code that executes a quartz job.At first the code was outside
Im a getting errors from some code developed in Java that want to use
What are PHP 5.2 settnigs which affect compatibility with old code (developed for PHP

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.