Q: How to use lightbox plug-in instead of window.open? Somewhere in my JavaScript code, it opens a new window with open function/method.
window.open("sample_link");

But I want open neither tab nor window. I found a lot of examples lightbox plug-in which act on element. May I use function/method of lightbox plug-in instead of open function in my JavaScript code? (not in html file) 

A: No, you can't. This plugin deals with user interaction. If you want to open the lightbox programmatically, you may try:
<a  href="img/image-1.jpg" data-lightbox="image-1" data-title="My caption">Image #1</a>

$('[data-lightbox]')[i].click();
// where i is the element you want

