How to use elgg-lightbox gallery, i've tried but failed

I've read http://learn.elgg.org/en/2.2/guides/javascript.html#module-elgg-lightbox

based on the link , i must use this code to use gallery

require(['elgg/lightbox'], function(lightbox) {
   var options = {
      photo: true,
      width: 500
   };
   lightbox.bind('a[rel="my-gallery"]', options, false); // 3rd attribute ensures binding is done without proxies
});

But i'm  still failed to make gallery

1. I put the code on the top of page , is it wrong ?

2. this is my "rel" implementation

<a href="this image should be in the gallery" class="elgg-lightbox-photo" rel="my-gallery"><img class="elgg-photo " src="image thumbnail" alt="Chrysanthemum.jpg" /></a>

is it wrong ?