Skip to content

Instantly share code, notes, and snippets.

@pottava
Created September 27, 2012 02:05
Show Gist options
  • Save pottava/3791759 to your computer and use it in GitHub Desktop.
Save pottava/3791759 to your computer and use it in GitHub Desktop.
交差判定js
function intersect(rect1, rect2) {
return ((rect2.bottom - rect1.top) * (rect2.top - rect1.bottom) < 0) &&
((rect2.right - rect1.left) * (rect2.left - rect1.right) < 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment