This is a question in the blog: http://q.cnblogs.com/q/39172/
My solution is as follows:
Function Isoverlap (idone, idtwo ){ VaR Objone = $ ("#" + Idone), objtwo = $ ("#" + Idtwo), offsetone = Objone. offset (), offsettwo = Objtwo. offset (), topone = Offsetone. Top, toptwo = Offsettwo. Top, leftone = Offsetone. Left, lefttwo =Offsettwo. Left, widthone = Objone. Width (), widthtwo = Objtwo. Width (), heightone = Objone. Height (), heighttwo = Objtwo. Height (); VaR Lefttop = lefttwo> leftone & lefttwo <leftone + Widthone & Toptwo> topone & toptwo <topone + Heightone, righttop = Lefttwo + widthtwo> leftone & lefttwo + widthtwo <leftone + Widthone & Toptwo> topone & toptwo <topone + Heightone, leftbottom = Lefttwo> leftone & lefttwo <leftone + Widthone & Toptwo + heighttwo> topone & toptwo + heighttwo <topone + Heightone, rightbottom = Lefttwo + widthtwo> leftone & lefttwo + widthtwo <leftone + Widthone & Toptwo + heighttwo> topone & toptwo + heighttwo <topone + Heightone; Return Lefttop | righttop | leftbottom | Rightbottom ;}
The principle is very simple, that is, to determine whether the four points of an element are inside the other element.
Demo:
If you have other solutions, please submit them.