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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:28:06+00:00 2026-06-05T07:28:06+00:00

I am using drag and scroll in my page, which is working with the

  • 0

I am using drag and scroll in my page, which is working with the 3 simple handlers mousedown, mousemove and mouseup.

Now i have 2 Issues:

  1. all my .on('click' and .click( events are kind of broken, because since the div is scrolling with the mouse, the cursor stays on the same object and the event fires. How can i change the handler so it only fires when the distance of mousemove between mousedown and mouseup is less than a fixed value? Is it even possible or do i have to create an own one and change all the code? —SOLVED—
  2. I am using event.preventDefault(); during this drag&scroll to prevent Selection. This results in the user not being able to click on form fields. Is there an easy way to fix this or do i have to stop the selection in another way? —SOLVED WITH WORKAROUND—

Any ideas would be helpful.

These are the 3 handlers for scrolling:

    mouseDownHandler : function(event) {

        if (!$(event.target).closest('.stopscroll').length) {

            event.data.lastCoord = {left: event.clientX, top: event.clientY}; 

            $.event.add( document, "mouseup", dragscroll.mouseUpHandler, event.data );
            $.event.add( document, "mousemove", dragscroll.mouseMoveHandler, event.data );

            $('body').addClass('dragcursor'); //// Add Move Cursor

            if (!$(event.target).closest('.noformelement').length) {
                event.preventDefault();
                return false;
            }
        }

    },

    mouseMoveHandler : function(event) { 
        var delta = {left: (event.clientX - event.data.lastCoord.left), top: (event.clientY - event.data.lastCoord.top)};

        event.data.scrollable.scrollLeft(event.data.scrollable.scrollLeft() - delta.left);

        $('.th-header').css('margin-left', -event.data.scrollable.scrollLeft()); //// Scrollsync with header

        event.data.scrollable.scrollTop(event.data.scrollable.scrollTop() - delta.top);

        event.data.lastCoord={left: event.clientX, top: event.clientY}

        if (!$(event.target).closest('.noformelement').length) {
            event.preventDefault();
            return false;
        }

    },

    mouseUpHandler : function(event) {
        $.event.remove( document, "mousemove", dragscroll.mouseMoveHandler);
        $.event.remove( document, "mouseup", dragscroll.mouseUpHandler);

        $('body').removeClass('dragcursor');

        if (!$(event.target).closest('.noformelement').length) {
            event.preventDefault();
            return false;
        }
    }

Update/Bump: Just disabling EVERY click event at once would already solve the problem i guess. I tried $(document).on('click', '*', function() {return false;}); but it does not work…

  • 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-05T07:28:07+00:00Added an answer on June 5, 2026 at 7:28 am

    Solved with

    mouseDownHandler : function(event) {
    
        if (!$(event.target).closest('.stopscroll').length) {
    
            event.data.lastCoord = {left: event.clientX, top: event.clientY}; 
            event.data.startCoord = {left: event.clientX, top: event.clientY};
            event.data.allowClick = true;
            $('*').off('click.stop');
    
            $.event.add( document, "mouseup", dragscroll.mouseUpHandler, event.data );
            $.event.add( document, "mousemove", dragscroll.mouseMoveHandler, event.data );
    
            if (!$(event.target).closest('.noformelement').length) {
                event.preventDefault();
                return false;
            }
        }
    
    },
    
    mouseMoveHandler : function(event) { 
        var delta = {left: (event.clientX - event.data.lastCoord.left), top: (event.clientY - event.data.lastCoord.top)};
        var range = {left: (event.clientX - event.data.startCoord.left), top: (event.clientY - event.data.startCoord.top)};
        if (event.data.allowClick && (Math.abs(range.left)>=5 || Math.abs(range.top)>=5)) {
            event.data.allowClick = false;
            $('*').on('click.stop', function() {return false;});
            $('body').addClass('dragcursor'); //// Add Move Cursor
        }
    
        event.data.scrollable.scrollLeft(event.data.scrollable.scrollLeft() - delta.left);
    
        $('.th-header').css('margin-left', -event.data.scrollable.scrollLeft()); //// Scrollsync with header
    
        event.data.scrollable.scrollTop(event.data.scrollable.scrollTop() - delta.top);
    
        event.data.lastCoord={left: event.clientX, top: event.clientY}
    
        if (!$(event.target).closest('.noformelement').length) {
            event.preventDefault();
            return false;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jquery Scrollview plugin ( http://code.google.com/p/jquery-scrollview/ ) to scroll drag a div
I have a zip file that is created using drag and drop on a
I am using Jquery Drag and drop to move divs across a page and
I have a list of <li> items that are dragged using jQuerys drag/drop. I'd
I have tried using drag n drop to place the control as well as
I have a Flex3 project with 2 HorizontalList controls; one of which has drag
I am using overflow: hidden on the body tag, which hides the scroll bars,
I'm using code below to drag CEikRichTextEditor contents up and down (Scroll) on touch
I'm using jQuery to drag items around. The items have click events. I'd like
We are using drag & drop utility between one source and multiple targets. We

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.