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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:53:27+00:00 2026-05-31T14:53:27+00:00

Here an example http://jsfiddle.net/naqbq/ How do I grab current position for x and y

  • 0

Here an example http://jsfiddle.net/naqbq/

How do I grab current position for x and y after re-position the image?

<input type="hidden" name="source_x" id="source_x" />
<input type="hidden" name="source_y" id="source_y" />
  • 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-31T14:53:28+00:00Added an answer on May 31, 2026 at 2:53 pm

    In the stop callback, you can use ui.helper to access the dragged element. Then use offset on it, as Brad suggested:

    $("#image").draggable({
        stop:function(event,ui) {
            var wrapper = $("#wrapper").offset();
            var borderLeft = parseInt($("#wrapper").css("border-left-width"),10);
            var borderTop = parseInt($("#wrapper").css("border-top-width"),10);
            var pos = ui.helper.offset();
            $("#source_x").val(pos.left - wrapper.left - borderLeft);
            $("#source_y").val(pos.top - wrapper.top - borderTop);
            alert($("#source_x").val() + "," + $("#source_y").val());
        }
    });​
    

    Then, it’s just a matter of adjusting it to your wrapper – subtracting its offset and its border’s width – and setting it to your input’s val. (sorry for hardcoding the border, but I couldn’t extract it using css) (Edit: there it is! found the solution in another question)

    http://jsfiddle.net/mgibsonbr/naqbq/4/

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

Sidebar

Related Questions

Here an example http://jsfiddle.net/x5mCR/ With the current code how do I make the big
Why height in Chrome is bigger than Firefox of input See example here http://jsfiddle.net/jitendravyas/89Msh/1/
here is link to an example: http://techchorus.net/demos/jquery/hiding-input-elements-in-a-div.html It actally disables few elements on click
You can see an example here: http://jsfiddle.net/TuH95/5/ When you hover over the li element
Here an example http://jsfiddle.net/6GdW6/ $(.thumbnail).live(click, function() { $(.fullimage).hide(); var i = $(<img />).attr(src, this.href).load(function()
Here is example http://jsfiddle.net/FredyC/3pynD/2/ although not fully functional yet, i am not sure how
Example here: http://jsfiddle.net/7h2Dh/ Got this html: <span>Text<div id=wtf>Content</div>Text</span> I need to set div display
Here's an example: http://jsfiddle.net/JPQxX/ I tried this in Chrome and FF. In both browsers
i have this simple example here : http://jsfiddle.net/pTyvc/1/ i don't want the sub_menu div
Please review the fiddle here for an example: http://jsfiddle.net/TKJsc/1/ Basically i'm trying to make

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.