3 ms·
I prefer lightbox implementations that extend a standard hyperlink to the enlarged image. If you middle-click, ctrl-click, etc, your browser grabs the URL from
by bradleyland 16y ago
I prefer lightbox implementations that extend a standard hyperlink to the enlarged image. If you middle-click, ctrl-click, etc, your browser grabs the URL from href and opens it in a new tab/window. The script is initiated by an event attached using a framework like jQuery, which uses a DOM query to locate links with a specific class. This has the additional upside of working as expected for users with JavaScript disabled. The implementations that fail miserably either use 'javascript:methodCall()' inside href, or have a kludgy onclick implementation.
Built properly, a lightbox shouldn't get in the way of your desired behavior.