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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:54:32+00:00 2026-05-26T21:54:32+00:00

I have an image inside a div, like so: <div><img src= class=draggable></div> It’s a

  • 0

I have an image inside a div, like so:

<div><img src="" class="draggable"></div>

It’s a draggable image, through jQuery UI. Now I want to determin how much the image is moved on the x-axis, so I can use that info to save the position of the image.

I.E. If the image is moved 100px left, x should be “-100px”, and if it’s moved to the right it should be “100px”..

I can use this, but it only determin how much the image was moved, not in a specific direction:

drag: function() {
                counts[ 1 ]++;
                updateCounterStatus( $drag_counter, counts[ 1 ] );
            },

Whats the solution ?

Thanks,
Jakob

  • 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-26T21:54:33+00:00Added an answer on May 26, 2026 at 9:54 pm

    Easy, if you want to save the image position when you stop dragging the image. Simply just check left and top of the image on stop:

    stop: function(event, ui) { 
        var topValue = $(this).position().top;
        var leftValue = $(this).position().left;
        //Save them to wherever you want
    }
    

    jQuery UI’s draggable isn’t doing anything magic, if you inspect it in Firebug or Chrome Dev Toolbar you will see that all it does is to alter the left and top property of the element.

    More information about the different events that Draggable have: http://jqueryui.com/demos/draggable/#events

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

Sidebar

Related Questions

I have a very simple div with an image inside: <div class=stack4> <img src=images/002m.jpg
I have a div contain the image inside it like this : <div class=gallery
I'd like to create an auto-scrollable image inside of a div. like, I have
suppose i have one div and div has img tag like <div><img src='img1.png'/></div> so
I have an element inside a div that is draggable jquery ui. And I
i have simple html that looks like this : <div class=img> <a target=_blank href=kl_big.htm
Say I have this: <div class='container'> <img src='image1' id='1' /> <img src='image2' id='2' />
I have a block with some text and image inside. Like: <div>I just posted
I have a thumbnail image inside a div. I use another image as the
I have a div tag <div id=theDiv>Where is the image?</div> I would like 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.