WebTolk Joomla Extensions
94 Extensions
11 Categories
458 Versions released
473576 Downloads
The plugin registers the Fancybox package in Joomla Web Assets Manager. After registration, you can use it in your extensions.
This is a plugin for Joomla developers. It allows you to use Fancybox.js anywhere in Joomla 4+: modules, components, plugins.
To do this, use in your code:
<?php
use Joomla\CMS\Factory;
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->usePreset('wtfancybox'); // Local file
$wa->usePreset('wtfancybox-remote'); // Use from CDN
The plugin can be used as a dependency when developing your extensions for Joomla 4+. The plugin uses the Joomla 4+ update system.
An example from the official documentation. HTML markup:
<a href="/image-a.jpeg" data-fancybox data-caption="Single image">
<img src="/thumbnail-a.jpeg" />
</a>
Javascript. It would be better to wrap a js in DOMContentLoaded
.
document.addEventListener('DOMContentLoaded', () => {
Fancybox.bind("[data-fancybox]", {
// Your custom options
});
});