Created
October 5, 2015 04:44
-
-
Save anonymous/011e705d1ee4e8340495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#sun").draggable({ | |
axis: "x", | |
drag: function() { | |
var xpos = parseFloat(this.style.left, 10) - 100; | |
var ypos = Math.sqrt(300 * 300 - xpos * xpos) * 0.75; | |
this.style["margin-top"] = (-ypos) + "px"; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var width = 300;
var rise = width / 2;
$("#sun").draggable({
axis: "x",
drag: function() {
var x = this.offsetLeft + (width / 2);
var y = this.offsetRight + (width / 2);
});