code: function preload() {
      if (!currGroup) {
        return;
      }
      var prev = new Image();
      var next = new Image();
      var pos = getPos(currThumbnail, currGroup);
      if (pos === (currImages.length - 1)) {
        // last image in group, preload first image and the one before
        prev.src = getAttr(currImages[currImages.length - 1], _const_dataattr) || currImages[currImages.length - 1].src;
        next.src = getAttr(currImages[0].src, _const_dataattr) || currImages[0].src;
      }
      else
        if (pos === 0) {
          // first image in group, preload last image and the next one
          prev.src = getAttr(currImages[currImages.length - 1], _const_dataattr) || currImages[currImages.length - 1].src;
          next.src = getAttr(currImages[1], _const_dataattr) || currImages[1].src;
        }
        else {
          // in between, preload prev & next image
          prev.src = getAttr(currImages[pos - 1], _const_dataattr) || currImages[pos - 1].src;
          next.src = getAttr(currImages[pos + 1], _const_dataattr) || currImages[pos + 1].src;
        }
    }
docs: Preloads next and prev images