code: function(e) {
      e = e || window.event;
      e.preventDefault ? e.preventDefault() : (e.returnValue = false);
  
      var eTarget = e.target || e.srcElement;
  
      // find root element of slide
      var clickedListItem = closest(eTarget, function(el) {
        //console.log(el.getAttribute('ui-gallery-item'));
        return el.getAttribute('ui-gallery-item') != null;
      });
  
      if (!clickedListItem) {
        return;
      }
  
      var parentNode = closest(eTarget, function(el) {
        return el.getAttribute('ui-gallery') != null;
      });
  
      if (!parentNode) {
        return;
      }
  
      var childNodes = parentNode.querySelectorAll('[ui-gallery-item]');
  
      // find index of clicked item by looping through all child nodes
      // alternatively, you may define index via data- attribute
      var clickedGallery = parentNode,
        numChildNodes = childNodes.length,
        nodeIndex = 0,
        index;
  
      for (var i = 0; i < numChildNodes; i++) {
        if (childNodes[i].nodeType !== 1) {
          continue;
        }
  
        if (childNodes[i] === clickedListItem) {
          index = nodeIndex;
          break;
        }
        nodeIndex++;
      }
      if (index >= 0) {
        // open PhotoSwipe if valid index found
        openPhotoSwipe(index, clickedGallery);
      }
      return false;
    }
docs: triggers when user clicks on thumbnail