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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:37:24+00:00 2026-06-17T18:37:24+00:00

I am using the jquery-ui draggable component with jquery.gantt here . I could do

  • 0

I am using the jquery-ui draggable component with jquery.gantt here. I could do enable drag on the items easily by $('.ganttRed').draggable() but the problem with this is that once we start scrolling the graph left to right using the slider below, the elements that are moved remain where they are instead of scrolling with the graph.

I looked through the source and from my understanding the margin-left is being changed during the scrolling; but jquery-ui uses the left attribute and in the presence of left the element keeps its position. My CSS knowledge ends just about there so if any of you are willing to provide any suggestions on how this can be fixed; I will greatly appreciate it.

I have a created a fiddle demonstrating the problem at: http://jsfiddle.net/Y2cxa/. In order to see the behavior I am speaking about:

  • Scroll the graph (either with your mouse wheel or the slider at the bottom); things should look and behave as expected.
  • Move any of the magenta(-ish) bars around and then scroll.

Again, thank you for your time and any assistance will be greatly appreciated.

Best regards

  • 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-17T18:37:25+00:00Added an answer on June 17, 2026 at 6:37 pm

    You have probably solved this or done something else by now but since I needed this aswell i solved it.

    Got a solution for you here:

    http://jsfiddle.net/Y2cxa/18/

    First I simply copied the left value to margin-left and then removed the left value completely, however this led to some strange numbers.

    To solve this I compared the start value of left with the final value of left and applied the same difference in pixels to margin-left!

    Simply replace:

    $('.ganttRed').draggable({axis:'x'});
    

    with:

    $('.ganttRed').draggable({
        axis:'x',
        start: function(event, ui) {
            $(this).data("startx",$(this).offset().left);
        },
        stop: function(event, ui) {
            var change = $(this).offset().left - $(this).data("startx");
            var value = $(this).css('margin-left');
            value = value.split("px");
            value = parseInt(value[0]) + change;
            $(this).css('margin-left', value);
            $(this).css('left', '');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery ui draggable, I do not want to let the user drag
I'm using jquery-ui's draggable for drag-and-drop, and jeditable for inline editing. When I drag
Hello! Im Using Jquery pep for Drag and Drop. I can make it draggable
I'm using Jquery Draggable Collision ( found here ) and I am trying to
I am using jquery-ui draggable. When I drag my box to beyond the bottom
I am using jQuery draggable/droppable to enable elements in a grid to be swapped.
How to make a element draggable without using jQuery UI? I have this code:
I've implemented drag and drop using the jQuery UI draggable widget . I'm now
How do I make an element, e.g. a div, draggable using jQuery?
I am using jQuery UI to make some elements draggable and droppable. Much like

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.