You could create your own click handler using event-delegation that opens fancybox, for example:

$( "body" ).on( "click", "btnForm", function() {
  $.fancybox.open({ src: $(this).attr('href'), type : 'inline' });
});
Answer from Janis on Stack Overflow
🌐
Fancyapps
fancyapps.com › fancybox
Fancybox | Fancyapps
Robust JavaScript UI Component Library
🌐
CodeSandbox
codesandbox.io › s › fancybox-vanilla-js-4uebs
fancybox-vanilla-js - CodeSandbox
November 9, 2021 - fancybox-vanilla-js by fancyapps using @fancyapps/ui, parcel-bundler
Published   Nov 09, 2021
Author   fancyapps
🌐
GitHub
github.com › JoHNNyRiver › fancybox-vanilla
GitHub - joaoaugustodev/fancybox-vanilla: This its a simple puling of the light box for images made with pure JS · GitHub
This its a simple puling of the light box for images made with pure JS - joaoaugustodev/fancybox-vanilla
Author   joaoaugustodev
🌐
GitHub
github.com › fancyapps › fancybox › issues › 2426
Vanilla JavaScript · Issue #2426 · fancyapps/fancybox
February 22, 2020 - Fancyapps / fancybox should now get rid of a nonsense library like jQuery and declare independence with vanilla JavaScript. I also need this very much :/
Author   ionurboz
🌐
DEV Community
dev.to › piotrzdziarski › fancybox-without-jquery-3p6j
Fancybox without jQuery - DEV Community
January 10, 2019 - I would like to ask you for an opinion about the project overall, but mainly about the code - https://github.com/PiotrZdziarski/Fullscreen-Lightbox-Basic . To be honest it's beginning of my journey with JS :P · And if someone is working on Mac, can you please check library on Safari and respond how it works on it? I would be very grateful :) ... Major changes in Vanilla Javascript Fullscreen Lightbox!
🌐
Fancybox
fancybox.net › howto
Fancybox - Fancy jQuery lightbox alternative| How to use
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="/fancybox/jquery.fancybox-1.3.4.pack.js"></script> Optional - Add transitions as jQuery by default supports only "swing" and "linear" <script type="text/javascript" src="/fancybox/jquery.easing-1.4.pack.js"></script> Optional - Enable "mouse-wheel" to navigate throught gallery items ·
Find elsewhere
🌐
GitHub
github.com › fancyapps › fancybox › issues › 1346
Drop jQuery · Issue #1346 · fancyapps/fancybox
April 6, 2017 - fancyapps / fancybox Public archive · Notifications · You must be signed in to change notification settings · Fork 1.8k · Star 7.3k · This repository was archived by the owner on Feb 23, 2023. It is now read-only. Copy link · Copy link · Closed · Closed · Drop jQuery#1346 · Copy link · Labels · Feature request · phifa · opened · on Apr 6, 2017 · Issue body actions · Howdy, just wanted to discuss dropping jQuery and going for Vanilla JS.
Author   phifa
🌐
CodePen
codepen.io › fancyapps › pen › vzoPMB
fancybox v3.5 - Initialize with JavaScript
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing. If active, Pens will autosave every 30 seconds after being saved once. If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update. If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting. ... Visit your global Editor Settings. ... <h2>fancybox v3.5 - Initialize with JavaScript</h2> <p> All options can be overridden by passing an object literal like any other jQuery plugin.
🌐
Fancybox
fancybox.net
Fancybox - Fancy jQuery lightbox alternative
FancyBox is a tool for displaying images, html content and multi-media in a Mac-style "lightbox" that floats overtop of web page. It was built using the jQuery library. Licensed under both MIT and GPL licenses · Different animations - 'fade', 'elastic' and 'none'
🌐
GitHub
github.com › fancyapps › fancybox
GitHub - fancyapps/fancybox: jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable. · GitHub
February 23, 2023 - 1. Add latest jQuery and Fancybox files · <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <link href="/path/to/jquery.fancybox.min.css" rel="stylesheet" /> <script src="/path/to/jquery.fancybox.min.js"></script> 2. Create links · <a data-fancybox="gallery" href="big_1.jpg"> <img src="small_1.jpg" /> </a> <a data-fancybox="gallery" href="big_2.jpg"> <img src="small_2.jpg" /> </a> 3.
Starred by 7.3K users
Forked by 1.8K users
Languages   JavaScript 90.3% | CSS 9.7%
🌐
Fancyapps
fancyapps.com
Fancyapps
Robust JavaScript UI Component Library
🌐
Vanilla Forums
open.vanillaforums.com › feedback
Fancybox Plugin for Vanilla - Feedback - Page 3 — Vanilla Forums
January 13, 2017 - {literal} <script type="text/javascript"> $(document).ready(function (){ $('.fancybox').attr('rel', '<?php $CommentID;?>').fancybox({ type : "image", // force type of content to image }); // fancybox }); // ready </script> {/literal} but this causes the image to not open at all when clicked. ... actually no, perhaps @peregrine or @x00 could help you here, as you would I think need the js version.
🌐
AlternativeTo
alternativeto.net › software › fancybox
Fancybox Alternatives: Top 9 Image Viewers & Similar Websites | AlternativeTo
Fancybox is described as 'FancyBox is a tool for displaying images, html content and multi-media in a Mac-style "lightbox" that floats overtop of web page. It was built using the jQuery library' and is a Image Viewer in the development category.
🌐
Ouachita Baptist University
obu.edu › _resources › ldp › galleries › fancybox
fancybox3 · Documentation
You can install fancybox by linking .css and .js files to your html file. Make sure you also load the jQuery library.
🌐
GitHub
github.com › joaoribeirodev › fancybox-vanilla
GitHub - joaoribeirodev/fancybox-vanilla: This its a simple puling of the light box for images made with pure JS
This its a simple puling of the light box for images made with pure JS - GitHub - joaoribeirodev/fancybox-vanilla: This its a simple puling of the light box for images made with pure JS
Author   joaoribeirodev
🌐
SourceForge
sourceforge.net › projects › fancybox.mirror
fancyBox download | SourceForge.net
Download fancyBox for free. jQuery lightbox script for displaying images, videos and more. Fancybox saves you time and helps to easily create beautiful, modern overlay windows containing images, iframes, videos or any kind of HTML content.
🌐
Libhunt
js.libhunt.com › fancybox-alternatives
fancyBox Alternatives - JavaScript Modals and Popups | LibHunt
February 22, 2023 - fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages.