Set Div position to Mouse position with jQuery

前端 未结 3 937
南方客
南方客 2021-01-04 10:06

I am trying to position my Div wherever the user clicks on my Image.

test is my Div, and myimg is my image.

Here is my JS:<

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 10:38

    It seems to work fine. I have set up a JSFiddle for you:

    http://jsfiddle.net/JPvya/

    Click on the image and the test div moves. The only change is using the $ short notation for JQuery instead of typing "JQuery" which, by the way is probably case sensetive and causing the problem!

提交回复
热议问题