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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:16:47+00:00 2026-05-25T20:16:47+00:00

I have a draggable element $myElement with revert: true . Now specifying revertDuration will

  • 0

I have a draggable element $myElement with revert: true. Now specifying revertDuration will determine the time the reverting animation will take to complete.

My problem is that the speed of the animation will vary greatly depending on how far $myElement is dropped from the original location.

Is there a way of specifying the speed of the animation (as opposed to the total time)?

  • 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-25T20:16:48+00:00Added an answer on May 25, 2026 at 8:16 pm

    What you need is position plugin for jQuery UI found here: http://jqueryui.com/demos/position/

    You can get offset of the draggable element. Or simply use:

    var x = $myElement.offset().left
    var y = $myElement.offset().top
    

    Solution which comes to my mind:
    Save position of the element when start event of draggable object is fired. Then do the same when ‘stop’ event occurs and animate the element back to starting offset. The difference in offsets is a line which its length will be proportional to the time required to travel back.

    var x,y;
    $myElement.draggable({
        start: function(event, ui) {
            x = $myElement.offset().left;
            y = $myElement.offset().top;
        },
        stop: function(event, ui) {
            // count the length of the line from starting point 
            // and trigger back animation 
        }
    });
    

    You can try to set revert duration when stop event is called to avoid animate but I don’t know if it make it before revert animation.

    $( ".selector" ).draggable( "option", "revertDuration", 1000 );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have a draggable element with more than one handle? I
I have a draggable div element with a hover style. This works fine, but
I have the following jQuery: $(document).ready(function () { $(.element).draggable(); $(.element).droppable({ drop: function () {
I have a draggable connected to a sortable: $(#panelTarget).sortable({ distance: '15' }); var element
I have a problem where the element calls .show() when the draggable triggers drag,
I have an element inside a div that is draggable jquery ui. And I
I have a draggable element and I would like to call PHP function each
I have draggable elements which can be dropped in droppable areas. If an element
I have a problem with jQuery Drag&Drop. I have a draggable element and lots
I have sortable, draggable and click events binded to the same DOM element. On

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.