When there is a picture element in the DIV element, it causes the drag to appear unexpectedly.
Because the picture element itself supports dragging, so long as the picture tag is added: Draggable= ' false '.
As follows:
<onmousedown= "Movebind (this, event)" style= "Width:50px;height : 50px; left:285px;top:370px; Position:absolute; " >< src= "Http://pic.cnitblog.com/face/614265/20140725231849.png" draggable = "false" ></ Div >
Add dynamic Add-on elements:
varContainerid = "Innercontainer"; varShowid = "Idshow"; varmoveelement = "Div"; functionaddelement (obj) {varimg = "<" + Obj.tagname + "src=" "+ obj.src +" ' draggable= ' false '/> '; varcontainer =findposition (document.getElementById (Containerid)); varContainerleft = container[0]; varContainertop = container[1]; varContainerwidth = container[4]; varContainerheight = container[5]; varleft = Containerleft + CONTAINERWIDTH/2-OBJ.OFFSETWIDTH/2; vartop = containertop + CONTAINERHEIGHT/2-OBJ.OFFSETHEIGHT/2; $("#" + Containerid). Append ("<div onmousedown= ' Movebind (this, event) ' style= ' width:" + obj.offsetwidth + "Px;height:" + Obj.offsetheight + "PX; Left: "+ Left +" Px;top: "+ top +" PX; Position:absolute; ' > "+ img +" </div> "); }
< Div > < src= "Http://pic.cnitblog.com/face/614265/20140725231849.png" style= " width:50px; height:50px; " onclick = "AddElement (this)" /> </ Div >
Use JS to make a mouse can drag the div (three)--Mobile with picture Div