Created
February 7, 2016 05:09
-
-
Save ModestGoblin/01f9b4c56556940f29bf 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
var pos_x; | |
var pos_y; | |
function myFunction(e) // called when click on image | |
{ | |
$("#title").val(""); | |
pos_x = event.offsetX?(event.offsetX):event.pageX-image.getElementById("pointer_div").offsetLeft; | |
pos_y = event.offsetY?(event.offsetY):event.pageY-image.getElementById("pointer_div").offsetTop; | |
x_pos = event.pageX; | |
y_pos = event.pageY; | |
x_pos = x_pos - 50; | |
y_pos = y_pos - 50; | |
var element = image.createElement('div'); | |
element.id = "someID"; | |
image.body.appendChild(element); | |
image.getElementById('someID').style.width='100px'; | |
image.getElementById('someID').style.height='100px'; | |
image.getElementById('someID').style.background='transparent'; | |
image.getElementById('someID').style.border='thick solid #0000FF'; | |
image.getElementById('someID').style.position = "absolute"; | |
x = image.getElementById('someID').style.left=x_pos+'px'; | |
y = image.getElementById('someID').style.top=y_pos+'px'; | |
form(x_pos,y_pos); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment