资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
判断可拖动div是否重合 重合多少
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Table</title> </head> <style type="text/css"> body{margin:0px; padding:0px; font-size:12px} .div{height:160px;width:160px;position:absolute; text-align:center; } .demo1{ border:1px solid #96C2F1;background-color:#EFF7FF;left:150px;top:20px} .demo2{ border:1px solid #9BDF70;background-color:#F0FBEB;left:450px;top:20px} .demo3{ border:1px solid #BBE1F1;background-color:#EEFAFF;left:750px;top:20px} .demo4{ border:1px solid #96C2F1;background-color:#EEFAFF;left:150px;top:220px} .demo5{ border:1px solid #FFCC00;background-color:#FFFFF7;left:450px;top:220px} .demo6{ border:1px solid #E3E197;background-color:#FFFFDD;left:750px;top:220px} .demo7{ border:1px solid #ADCD3C;background-color:#F2FDDB;left:150px;top:420px} .demo8{ border:1px solid #F8B3D0;background-color:#FFF5FA;left:450px;top:420px} .demo9{ border:1px solid #D3D3D3;background-color:#F7F7F7;left:750px;top:420px} .focus{background-color: #990000;} </style> <body > <div id='demo1' class='div demo1'>demo1</div> <div id='demo2' class='div demo2'>demo2</div> <div id='demo3' class='div demo3'>demo3</div> <div id='demo4' class='div demo4'>demo4</div> <div id='demo5' class='div demo5'>demo5</div> <div id='demo6' class='div demo6'>demo6</div> <div id='demo7' class='div demo7'>demo7</div> <div id='demo8' class='div demo8'>demo8</div> <div id='demo9' class='div demo9'>demo9</div> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20language%3D%22javascript%22%3E%20%0D%0A(function(window%2Cundefined)%7B%20%0D%0Awindow.Sys%20%3D%20function%20(ua)%7B%20%0D%0Avar%20b%20%3D%20%7B%20%0D%0Aie%3A%20%2Fmsie%2F.test(ua)%20%26%26%20!%2Fopera%2F.test(ua)%2C%20%0D%0Aopera%3A%20%2Fopera%2F.test(ua)%2C%20%0D%0Asafari%3A%20%2Fwebkit%2F.test(ua)%20%26%26%20!%2Fchrome%2F.test(ua)%2C%20%0D%0Afirefox%3A%20%2Ffirefox%2F.test(ua)%2C%20%0D%0Achrome%3A%20%2Fchrome%2F.test(ua)%20%0D%0A%7D%2CvMark%20%3D%20%22%22%3B%20%0D%0Afor%20(var%20i%20in%20b)%20%7B%20%0D%0Aif%20(b%5Bi%5D)%20%7B%20vMark%20%3D%20%22safari%22%20%3D%3D%20i%20%3F%20%22version%22%20%3A%20i%3B%20break%3B%20%7D%20%0D%0A%7D%20%0D%0Ab.version%20%3D%20vMark%20%26%26%20RegExp(%22(%3F%3A%22%20%2B%20vMark%20%2B%20%22)%5B%5C%5C%2F%3A%20%5D(%5B%5C%5Cd.%5D%2B)%22).test(ua)%20%3F%20RegExp.%241%20%3A%20%220%22%3B%20%0D%0Ab.ie6%20%3D%20b.ie%20%26%26%20parseInt(b.version%2C%2010)%20%3D%3D%206%3B%20%0D%0Ab.ie7%20%3D%20b.ie%20%26%26%20parseInt(b.version%2C%2010)%20%3D%3D%207%3B%20%0D%0Ab.ie8%20%3D%20b.ie%20%26%26%20parseInt(b.version%2C%2010)%20%3D%3D%208%3B%20%0D%0Areturn%20b%3B%20%0D%0A%7D(window.navigator.userAgent.toLowerCase())%3B%20%0D%0A%0D%0Awindow.Sys.ie6%26%26document.execCommand(%22BackgroundImageCache%22%2C%20false%2C%20true)%3B%20%0D%0A%0D%0Awindow.%24%20%3D%20function(Id)%7B%20%0D%0Areturn%20document.getElementById(Id)%3B%20%0D%0A%7D%3B%20%0D%0Awindow.addListener%20%3D%20function(element%2Ce%2Cfn)%7B%20%0D%0A!element.events%26%26(element.events%20%3D%20%7B%7D)%3B%20%0D%0Aelement.events%5Be%5D%26%26(element.events%5Be%5D%5BaddListener.guid%2B%2B%5D%3Dfn)%7C%7C(element.events%5Be%5D%20%3D%20%7B'0'%3Afn%7D)%3B%20%0D%0Aelement.addEventListener%3Felement.addEventListener(e%2Cfn%2Cfalse)%3Aelement.attachEvent(%22on%22%20%2B%20e%2Cfn)%3B%20%0D%0A%7D%3B%20%0D%0Awindow.addListener.guid%20%3D%201%3B%20%0D%0Awindow.removeListener%20%3D%20function(element%2Ce%2Cfn)%7B%20%0D%0Avar%20handlers%20%3D%20element.events%5Be%5D%2Ctype%3B%20%0D%0Aif(fn)%7B%20%0D%0Afor(type%20in%20handlers)%20%0D%0Aif(handlers%5Btype%5D%3D%3D%3Dfn)%7B%20%0D%0Aelement.removeEventListener%3Felement.removeEventListener(e%2Cfn%2Cfalse)%3Aelement.detachEvent(%22on%22%20%2B%20e%2Cfn)%3B%20%0D%0Adelete%20handlers%5Btype%5D%3B%20%0D%0A%7D%20%0D%0A%7Delse%7B%20%0D%0Afor(type%20in%20handlers)%7B%20%0D%0Aelement.removeEventListener%3Felement.removeEventListener(e%2Chandlers%5Btype%5D%2Cfalse)%3Aelement.detachEvent(%22on%22%20%2B%20e%2Chandlers%5Btype%5D)%3B%20%0D%0Adelete%20handlers%5Btype%5D%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%7D%3B%20%0D%0Awindow.setStyle%20%3D%20function(e%2Co)%7B%20%0D%0Aif(typeof%20o%3D%3D%22string%22)%20%0D%0Ae.style.cssText%3Do%3B%20%0D%0Aelse%20%0D%0Afor(var%20i%20in%20o)%20%0D%0Ae.style%5Bi%5D%20%3D%20o%5Bi%5D%3B%20%0D%0A%7D%3B%20%0D%0A%0D%0Avar%20slice%20%3D%20Array.prototype.slice%3B%20%0D%0Awindow.Bind%20%3D%20function(object%2C%20fun)%20%7B%20%0D%0Avar%20args%20%3D%20slice.call(arguments).slice(2)%3B%20%0D%0Areturn%20function()%20%7B%20%0D%0Areturn%20fun.apply(object%2C%20args)%3B%20%0D%0A%7D%3B%20%0D%0A%7D%3B%20%0D%0Awindow.BindAsEventListener%20%3D%20function(object%2C%20fun%2Cargs)%20%7B%20%0D%0Avar%20args%20%3D%20slice.call(arguments).slice(2)%3B%20%0D%0Areturn%20function(event)%20%7B%20%0D%0Areturn%20fun.apply(object%2C%20%5Bevent%20%7C%7C%20window.event%5D.concat(args))%3B%20%0D%0A%7D%20%0D%0A%7D%3B%20%0D%0A%2F%2Fcopy%20from%20jQ%20%0D%0Awindow.extend%20%3D%20function()%7B%20%0D%0Avar%20target%20%3D%20arguments%5B0%5D%20%7C%7C%20%7B%7D%2C%20i%20%3D%201%2C%20length%20%3D%20arguments.length%2C%20deep%20%3D%20true%2C%20options%3B%20%0D%0Aif%20(%20typeof%20target%20%3D%3D%3D%20%22boolean%22%20)%20%7B%20%0D%0Adeep%20%3D%20target%3B%20%0D%0Atarget%20%3D%20arguments%5B1%5D%20%7C%7C%20%7B%7D%3B%20%0D%0Ai%20%3D%202%3B%20%0D%0A%7D%20%0D%0Aif%20(%20typeof%20target%20!%3D%3D%20%22object%22%20%26%26%20Object.prototype.toString.call(target)!%3D%22%5Bobject%20Function%5D%22)%20%0D%0Atarget%20%3D%20%7B%7D%3B%20%0D%0Afor(%3Bi%3Clength%3Bi%2B%2B)%7B%20%0D%0Aif%20(%20(options%20%3D%20arguments%5B%20i%20%5D)%20!%3D%20null%20)%20%0D%0Afor(var%20name%20in%20options)%7B%20%0D%0Avar%20src%20%3D%20target%5B%20name%20%5D%2C%20copy%20%3D%20options%5B%20name%20%5D%3B%20%0D%0Aif%20(%20target%20%3D%3D%3D%20copy%20)%20%0D%0Acontinue%3B%20%0D%0Aif%20(%20deep%20%26%26%20copy%20%26%26%20typeof%20copy%20%3D%3D%3D%20%22object%22%20%26%26%20!copy.nodeType%20)%7B%20%0D%0Atarget%5B%20name%20%5D%20%3D%20arguments.callee(%20deep%2C%20src%20%7C%7C%20(%20copy.length%20!%3D%20null%20%3F%20%5B%20%5D%20%3A%20%7B%20%7D%20)%2C%20copy%20)%3B%20%0D%0A%7D%20%0D%0Aelse%20if(copy%20!%3D%3D%20undefined)%20%0D%0Atarget%5B%20name%20%5D%20%3D%20copy%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0Areturn%20target%3B%20%0D%0A%7D%3B%20%0D%0A%2F%2Fcopy%20from%20jQ%20%0D%0Awindow.each%20%3D%20function%20(%20object%2C%20callback%2C%20args%20)%20%7B%20%0D%0Avar%20name%2C%20i%20%3D%200%2C%20length%20%3D%20object.length%3B%20%0D%0Aif%20(%20args%20)%20%7B%20%0D%0Aargs%20%3D%20Array.prototype.slice.call(arguments).slice(2)%3B%20%0D%0Aif%20(%20length%20%3D%3D%3D%20undefined%20)%20%7B%20%0D%0Afor%20(%20name%20in%20object%20)%20%0D%0Aif%20(%20callback.apply(%20object%5B%20name%20%5D%2C%5Bname%2Cobject%5B%20name%20%5D%5D.concat(args)%20)%20%3D%3D%3D%20false%20)%20%0D%0Abreak%3B%20%0D%0A%7D%20else%20%0D%0Afor%20(%20%3B%20i%20%3C%20length%3B%20i%2B%2B)%20%0D%0Aif%20(%20callback.apply(%20object%5B%20i%20%5D%2C%5Bi%2Cobject%5B%20i%20%5D%5D.concat(args))%20%3D%3D%3D%20false%20)%20%2F%2F%20%0D%0Abreak%3B%20%0D%0A%7D%20else%20%7B%20%0D%0Aif%20(%20length%20%3D%3D%3D%20undefined%20)%20%7B%20%0D%0Afor%20(%20name%20in%20object%20)%20%0D%0Aif%20(%20callback.call(%20object%5B%20name%20%5D%2C%20name%2C%20object%5B%20name%20%5D%20)%20%3D%3D%3D%20false%20)%20%0D%0Abreak%3B%20%0D%0A%7D%20else%20%0D%0Afor%20(%20var%20value%20%3D%20object%5B0%5D%3B%20%0D%0Ai%20%3C%20length%20%26%26%20callback.call(%20value%2C%20i%2C%20value%20)%20!%3D%3D%20false%3B%20value%20%3D%20object%5B%2B%2Bi%5D%20)%7B%7D%20%0D%0A%7D%20%0D%0Areturn%20object%3B%20%0D%0A%7D%3B%20%0D%0Awindow.currentStyle%20%3D%20function(element)%7B%20%0D%0Areturn%20element.currentStyle%20%7C%7C%20document.defaultView.getComputedStyle(element%2C%20null)%3B%20%0D%0A%7D%3B%20%0D%0Awindow.objPos%20%3D%20function(elem)%7B%20%0D%0Avar%20left%20%3D%200%2C%20top%20%3D%200%2C%20right%20%3D%200%2C%20bottom%20%3D%200%2Cdoc%20%3D%20elem%20%3F%20elem.ownerDocument%20%3A%20document%3B%20%0D%0Aif%20(%20!elem.getBoundingClientRect%20%7C%7C%20window.Sys.ie8%20)%20%7B%20%0D%0Avar%20n%20%3D%20elem%3B%20%0D%0Awhile%20(n)%20%7B%20left%20%2B%3D%20n.offsetLeft%2C%20top%20%2B%3D%20n.offsetTop%3B%20n%20%3D%20n.offsetParent%3B%20%7D%3B%20%0D%0Aright%20%3D%20left%20%2B%20elem.offsetWidth%3B%20bottom%20%3D%20top%20%2B%20elem.offsetHeight%3B%20%0D%0A%7D%20else%20%7B%20%0D%0Avar%20rect%20%3D%20elem.getBoundingClientRect()%3B%20%0D%0Aleft%20%3D%20right%20%3D%20doc.documentElement.scrollLeft%20%7C%7C%20doc.body.scrollLeft%3B%20%0D%0Atop%20%3D%20bottom%20%3D%20doc.documentElement.scrollLeft%20%7C%7C%20doc.body.scrollLeft%3B%20%0D%0Aleft%20%2B%3D%20rect.left%3B%20right%20%2B%3D%20rect.right%3B%20%0D%0Atop%20%2B%3D%20rect.top%3B%20bottom%20%2B%3D%20rect.bottom%3B%20%0D%0A%7D%20%0D%0Areturn%20%7B%20%22left%22%3A%20left%2C%20%22top%22%3A%20top%2C%20%22right%22%3A%20right%2C%20%22bottom%22%3A%20bottom%20%7D%3B%20%0D%0A%7D%3B%20%0D%0Awindow.hasClass%20%3D%20function(element%2C%20className)%7B%20%0D%0Areturn%20element.className.match(new%20RegExp('(%5C%5Cs%7C%5E)'%2BclassName%2B'(%5C%5Cs%7C%24)'))%3B%20%0D%0A%7D%3B%20%0D%0Awindow.addClass%20%3D%20function(element%2C%20className)%7B%20%0D%0A!window.hasClass(element%2C%20className)%26%26(element.className%20%2B%3D%20%22%20%22%2BclassName)%3B%20%0D%0A%7D%3B%20%0D%0Awindow.removeClass%20%3D%20function(element%2C%20className)%7B%20%0D%0Awindow.hasClass(element%2C%20className)%26%26(element.className%20%3D%20element.className.replace(new%20RegExp('(%5C%5Cs%7C%5E)'%2BclassName%2B'(%5C%5Cs%7C%24)')%2C'%20'))%3B%20%0D%0A%7D%20%0D%0A%7D)(window)%3B%20%0D%0A%0D%0Avar%20Drag%20%3D%20%7B%20%0D%0Aelem%20%3A%20null%2C%20%0D%0Azindex%20%3A%200%2C%20%0D%0Aoptions%20%3A%20%7B%7D%2C%20%0D%0Ainit%20%3A%20function()%7B%20%0D%0Aeach(arguments%2Cfunction(i%2Celem%2CoThis)%7B%20%0D%0AaddListener(elem%2C'mousedown'%2CBindAsEventListener(oThis%2CoThis.start%2Celem))%3B%20%0D%0A%7D%2Cthis)%3B%20%0D%0A%7D%2C%20%0D%0Astart%20%3A%20function(e%2Celem)%7B%20%0D%0Avar%20elem%3Dthis.elem%20%3D%20elem%3B%20%0D%0Aelem.style.zIndex%3D%2B%2Bthis.zindex%3B%20%0D%0Athis.x%20%3D%20e.clientX%20-%20elem.offsetLeft%20%3B%20%0D%0Athis.y%20%3D%20e.clientY%20-%20elem.offsetTop%3B%20%0D%0Athis.marginLeft%20%3D%20parseInt(currentStyle(elem).marginLeft)%7C%7C0%3B%20%0D%0Athis.marginTop%20%3D%20parseInt(currentStyle(elem).marginTop)%7C%7C0%3B%20%0D%0ASys.ie%3Felem.setCapture()%3Ae.preventDefault()%3B%20%0D%0AaddListener(document%2C%22mousemove%22%2CBindAsEventListener(this%2Cthis.move))%3B%20%0D%0AaddListener(document%2C%22mouseup%22%2CBind(this%2Cthis.up))%3B%20%0D%0Athis.options.callbackmove%26%26this.options.callbackmove(this.elem)%3B%20%0D%0A%7D%2C%20%0D%0Amove%20%3A%20function(e)%7B%20%0D%0Awindow.getSelection%20%3F%20window.getSelection().removeAllRanges()%20%3A%20document.selection.empty()%3B%20%0D%0Avar%20iLeft%20%3D%20e.clientX%20-%20this.x%2CiTop%20%3D%20e.clientY%20-%20this.y%3Bobj%20%3D%20this.elem%3B%20%0D%0Aobj.style.left%20%3D%20iLeft%20-%20this.marginLeft%20%2B%20%22px%22%3B%20%0D%0Aobj.style.top%20%3D%20iTop%20-%20this.marginTop%20%2B%20%22px%22%3B%20%0D%0Athis.options.callbackmove%26%26this.options.callbackmove(this.elem)%3B%20%0D%0A%7D%2C%20%0D%0Aup%20%3A%20function()%7B%20%0D%0AremoveListener(document%2C'mousemove')%3B%20%0D%0AremoveListener(document%2C'mouseup')%3B%20%0D%0ASys.ie%26%26this.elem.releaseCapture()%3B%20%0D%0Athis.options.callbackup%26%26this.options.callbackup(this.elem)%3B%20%0D%0A%7D%20%0D%0A%7D%3B%20%0D%0A%0D%0Avar%20overlap%20%3D%20%7B%20%0D%0Ahostel%20%3A%7B%7D%2C%20%2F%2F%E6%89%80%E6%9C%89%E9%9C%80%E8%A6%81%E8%AE%A1%E7%AE%97%E9%87%8D%E5%90%88%E7%9A%84%E5%85%83%E7%B4%A0%20%0D%0AoverlapList%20%3A%7B%7D%2C%20%2F%2F%E5%B7%B2%E7%BB%8F%E9%87%8D%E5%90%88%E7%9A%84%E5%85%83%E7%B4%A0%20%0D%0Ainit%20%3A%20function(elems)%7B%20%0D%0Aeach(elems%2Cfunction(i%2Celem%2CoThis)%7B%20%0D%0Aelem.setAttribute('overlap'%2Ci)%3B%20%0D%0Avar%20ret%20%3D%20objPos(elem)%2Cl%3Dret.left%2Ct%3Dret.top%2Cb%3Dret.bottom%2Cr%3Dret.right%3B%20%0D%0AoThis.hostel%5Bi%5D%3D%7Belem%3Aelem%2CleftTopDot%3A%7Bx%3Al%2Cy%3At%7D%2CleftBottomDot%3A%7Bx%3Al%2Cy%3Ab%7D%2CrightTopDot%3A%7Bx%3Ar%2Cy%3At%7D%2CrightBottomDot%3A%7Bx%3Ar%2Cy%3Ab%7D%7D%3B%20%0D%0A%7D%2Cthis)%3B%20%0D%0A%7D%2C%20%0D%0AsetElem%3Afunction(elem)%7B%20%0D%0Aif(!elem)return%3B%20%0D%0Avar%20ret%20%3D%20objPos(elem)%2Cl%3Dret.left%2Ct%3Dret.top%2Cb%3Dret.bottom%2Cr%3Dret.right%3B%20%0D%0Athis.hostel%5Belem.getAttribute('overlap')%5D%20%3D%7Belem%3Aelem%2CleftTopDot%3A%7Bx%3Al%2Cy%3At%7D%2CleftBottomDot%3A%7Bx%3Al%2Cy%3Ab%7D%2CrightTopDot%3A%7Bx%3Ar%2Cy%3At%7D%2CrightBottomDot%3A%7Bx%3Ar%2Cy%3Ab%7D%7D%3B%20%0D%0A%7D%2C%20%0D%0A%2F%2F%E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E9%87%8D%E5%90%88%20%0D%0AisOverlap%20%3A%20function(my)%7B%20%0D%0Avar%20obj%3D%20%7B%7D%2C%20my%20%3D%20this.hostel%5Bmy.getAttribute('overlap')%5D%3B%20%0D%0A%0D%0Aeach(this.hostel%2Cfunction(key%2Cconfig%2CoThis)%7B%20%0D%0A%2F%2F%20%E6%98%AF%E5%85%83%E7%B4%A0%E6%9C%AC%E8%BA%AB%20%E5%88%99%E8%BF%94%E5%9B%9E%20%0D%0Aif(config.elem%20%3D%3D%3D%20my.elem)return%20%3B%20%0D%0A%0D%0A%2F%2F%E5%88%A4%E6%96%AD2%E4%B8%AAdiv%E6%98%AF%E5%90%A6%E9%87%8D%E5%90%88%20%E5%A6%82%E6%9E%9C%E4%B8%8D%E9%87%8D%E5%90%88%20%E5%88%99%E8%BF%94%E5%9B%9E%20%0D%0Aif(my.leftBottomDot.y%3C%3Dconfig.leftTopDot.y%7C%7Cmy.leftTopDot.y%3E%3Dconfig.leftBottomDot.y%7C%7Cmy.rightTopDot.x%3C%3Dconfig.leftTopDot.x%7C%7Cmy.leftTopDot.x%3E%3Dconfig.rightTopDot.x)%20%0D%0Areturn%3B%20%0D%0Aobj%5Bconfig.elem.getAttribute('overlap')%5D%20%3D%5Bconfig.elem%2CoThis.howOverlap(my%2Cconfig)%5D%3B%20%0D%0A%7D%2Cthis)%3B%20%0D%0Areturn%20obj%3B%20%0D%0A%7D%2C%20%0D%0A%2F%2F%E5%88%A4%E6%96%AD%E9%87%8D%E5%90%88%E9%9D%A2%E7%A7%AF%20%0D%0AhowOverlap%20%3A%20function(my%2Cother)%7B%20%0D%0Avar%20l%3Dother.leftBottomDot.x%2Cr%3Dother.rightTopDot.x%2Ct%3Dother.leftTopDot.y%2Cb%3Dother.leftBottomDot.y%2Carr%3D%5B%5D%2C%20%0D%0Alt%20%3D%20this.include(my.leftTopDot%2Cl%2Cr%2Ct%2Cb%2C'leftTopDot-rightBottomDot')%2C%20%0D%0Alb%20%3D%20this.include(my.leftBottomDot%2Cl%2Cr%2Ct%2Cb%2C'leftBottomDot-rightTopDot')%2C%20%0D%0Art%20%3D%20this.include(my.rightTopDot%2Cl%2Cr%2Ct%2Cb%2C'rightTopDot-leftBottomDot')%2C%20%0D%0Arb%20%3D%20this.include(my.rightBottomDot%2Cl%2Cr%2Ct%2Cb%2C'rightBottomDot-leftTopDot')%3B%20%0D%0Alt%26%26arr.push(lt)%7C%7Clb%26%26arr.push(lb)%7C%7Crt%26%26arr.push(rt)%7C%7Crb%26%26arr.push(rb)%3B%20%0D%0A%0D%0Aif(!arr%5B0%5D)%20return%200%3B%20%0D%0A%2F%2F%E4%B8%80%E4%B8%AA%E7%82%B9%20%E6%88%96%E8%80%85%E6%98%AF%202%E4%B8%AA%E7%82%B9%E9%83%BD%E5%9C%A8%E5%85%B6%E4%B8%AD%20%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95%E6%98%AF%E4%B8%80%E6%A0%B7%E7%9A%84%20%0D%0Aif(arr.length%3D%3D%3D1%7C%7Carr.length%3D%3D%3D2)%7B%20%0D%0Avar%20key%20%3D%20arr%5B0%5D.split('-')%2Cx1%3Dmy%5Bkey%5B0%5D%5D.x%2Cy1%3Dmy%5Bkey%5B0%5D%5D.y%2Cx2%3Dother%5Bkey%5B1%5D%5D.x%2Cy2%3Dother%5Bkey%5B1%5D%5D.y%3B%20%0D%0Areturn%20Math.abs((x1-x2)*(y1-y2))%3B%20%0D%0A%7D%3B%20%0D%0A%2F%2F%E5%AE%8C%E5%85%A8%E9%87%8D%E5%90%88%20%0D%0Aif(arr.length%3D%3D%3D4)%7B%20%0D%0Areturn%20162*162%3B%20%0D%0A%7D%3B%20%0D%0A%7D%2C%20%0D%0A%2F%2F%E7%9C%8B%E7%82%B9%E6%98%AF%E4%B8%8D%E6%98%AF%E5%9C%A8%E5%8F%A6%E4%B8%80%E4%B8%AAdiv%E4%B8%AD%20%0D%0Ainclude%20%3A%20function(dot%2Cl%2Cr%2Ct%2Cb%2Ckey)%7B%20%0D%0Areturn%20(dot.x%3E%3Dl%26%26dot.x%3C%3Dr%26%26dot.y%3E%3Dt%26%26dot.y%3C%3Db)%3Fkey%3Afalse%3B%20%0D%0A%7D%20%0D%0A%7D%3B%20%0D%0Awindow.onload%20%3D%20function()%7B%20%0D%0Aextend(Drag.options%2C%7Bcallbackmove%3Amove%2Ccallbackup%3Aup%7D)%3B%20%0D%0A%0D%0Afunction%20up(elem)%7B%20%0D%0Afor(var%20n%20in%20overlap.overlapList)%20%0D%0AremoveClass(overlap.overlapList%5Bn%5D%5B0%5D%2C'focus')%20%0D%0Aoverlap.overlapList%20%3D%20%7B%7D%3B%20%0D%0ADrag.elem.innerHTML%20%3DDrag.elem.id%3B%20%0D%0A%7D%3B%20%0D%0A%0D%0Afunction%20move(elem)%7B%20%0D%0Aoverlap.setElem(elem)%3B%20%0D%0A%2F%2Fp%E4%B8%BA%E5%88%A4%E6%96%AD%E8%BF%94%E5%9B%9E%E7%9A%84obj%E6%98%AF%E4%B8%8D%E6%98%AF%E7%A9%BA%E7%9A%84%20%0D%0Avar%20obj%20%3D%20overlap.isOverlap(elem)%2Cname%2Cp%20%3D%20function(o)%7B%20%0D%0Afor%20(name%20in%20o)%20%0D%0Areturn%20false%3B%20%0D%0Areturn%20true%3B%20%0D%0A%7D(obj)%3B%20%0D%0A%0D%0A%2F%2F%E5%A6%82%E6%9E%9C%E6%98%AF%E4%B8%AA%E7%A9%BA%E5%AF%B9%E8%B1%A1%20%E5%88%99%E8%BF%94%E5%9B%9E%20%E4%B8%8D%E8%BF%9B%E8%A1%8C%E4%B8%8B%E9%9D%A2%E7%9A%84%E9%81%8D%E5%8E%86%20%0D%0Aif(p)%7B%20%0D%0Aup()%3B%20%0D%0Areturn%3B%20%0D%0A%7D%3B%20%0D%0A%0D%0Avar%20str%20%3D''%3B%20%0D%0Aoverlap.overlapList%20%3D%20obj%3B%20%0D%0Aeach(overlap.hostel%2Cfunction(key%2Cconfig)%7B%20%0D%0Aif(obj%5Bkey%5D)%7B%20%0D%0AaddClass(obj%5Bkey%5D%5B0%5D%2C'focus')%3B%20%0D%0Astr%20%3D%20str%20%2B'%E4%B8%8E'%2Bobj%5Bkey%5D%5B0%5D.id%2B'%E9%87%8D%E5%90%88%E7%9A%84%E9%9D%A2%E7%A7%AF%E4%B8%BA%3A'%2Bobj%5Bkey%5D%5B1%5D%2B'%3C%2Fbr%3E'%3B%20%0D%0A%7Delse%7B%20%0D%0AremoveClass(config.elem%2C'focus')%3B%20%0D%0A%7D%20%0D%0A%7D)%3B%20%0D%0ADrag.elem.innerHTML%20%3D%20str%3B%20%0D%0A%7D%3B%20%0D%0ADrag.init(%24('demo1')%2C%24('demo2')%2C%24('demo3')%2C%24('demo4')%2C%24('demo5')%2C%24('demo6')%2C%24('demo7')%2C%24('demo8')%2C%24('demo9'))%3B%20%0D%0Aoverlap.init(%5B%24('demo1')%2C%24('demo2')%2C%24('demo3')%2C%24('demo4')%2C%24('demo5')%2C%24('demo6')%2C%24('demo7')%2C%24('demo8')%2C%24('demo9')%5D)%3B%20%0D%0A%7D%3B%20%0D%0A%3C%2Fscript%3E"> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程