How to have a function fire when collision & returns occur

How to have a function fire when collision & returns occur

I've been messing around with jQuery Collision for some time now but still cannot figure out how to make use of it in a simple way, despite having examples to try to help.

http://sourceforge.net/p/jquerycollision/wiki/Home/#usage says this:
  • Basic usage returns the obstacles that are hit by the colliders:
    1. var colliders_selector = ".collider"; 
    2. var obstacles_selector = ".obstacle"; 
    3. var hits = $(colliders_selector).collision(obstacles_selector) 

How can I craft a statement that has a function fire when var hits notices that a collision has occurred? I tried doing this:

  1.         var colliders_selector = $(links[i]);
  2.         var obstacles_selector = ".footer";
  3.         var hits = $(colliders_selector).collision(obstacles_selector)
  4.        
  5.         if (hits) {
  6.             alert("d");
  7.         }

But the alerts occur even before a collision does, so I assume the if statement is just noting that hits exists 4 times. 

I also tried this because it is similar to an example's code:

  1. var colliders_selector = $(links[i]);
    var obstacles_selector = ".footer";
    var hits = $(colliders_selector).collision(obstacles_selector)
  2. for (var i=0; i<hits.length; i++) {         
    }

But the for loop caused the browser to freeze so obviously I'm doing something wrong there, too.

So I'm rather at a loss for what to do. Help would be appreciated.