Ok I know!
It sounds a little bit weird (probably cause of my english which isnt perfect, but I hope you guys understand me so far) but I want to draw a line (with HTML5) from a div to another div. But I want to find out the mid of the top from a div or the the mid of the bottom from a div.
Pretty sure I have big thinking barrier ... please help me get over this barrier!
How can I find out?
Thx so far Nubu
So, to break it down for you, you first need to determine the coordinates of the div1-bottom-center and div2-top-center. If you use jQuery then this is fairly easy by using $(divX).offset()
, $(divX).width()
and $(divX).height()
. Then you can use that to draw the line correctly.
An alternative, depending on what you want to accomplish, is to use an existing library for this, such as jsPlumb .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.