码迷,mamicode.com
首页 > 其他好文 > 详细

碰撞检测插件

时间:2019-02-15 15:38:14      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:hit   else   top   height   fse   The   etl   lse   UNC   

//碰撞检测

//碰撞返回true    没碰撞返回false

function isHited(a,b){
  if(a.offsetLeft+a.offsetWidth<=b.offsetLeft||a.offsetTop+a.offsetHeight<=b.offsetTop||a.offsetLeft>=b.offsetLeft+b.offsetWidth||a.offsetTop>=b.offsetTop+b.offsetHeight){
    return false;
  }
  else{
    return true;
  }
}

碰撞检测插件

标签:hit   else   top   height   fse   The   etl   lse   UNC   

原文地址:https://www.cnblogs.com/shangjun6/p/10383593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!