A
A
Apostol632021-06-07 15:08:44
Joomla
Apostol63, 2021-06-07 15:08:44

Why doesn't fancybox work in joomla 3?

Good day to all.

I'm trying to connect fancybox to joomla (downloaded the latest stable version). Further, in the js file, where I write my scripts, I write

$(document).ready(function() {
    $('a.gallery').fancybox();
});

What I get in the console is the error $(....).fancybox is not
a
60be0bb8e7ade166365546.png
function I found info in Google, they say the jq version is not suitable (although the correspondence on the forum is from 2015). Put, for the sake of interest, jq version 1.3 and still does not work. Who knows how this can be fixed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Apostol63, 2021-06-07
@Apostol63

I solved the problem. If anyone is interested, then instead try to write Well and to the heap in $(document).ready(function() {}); You can also change the dollar sign to jQuery. Helped me
$('a.gallery').fancybox();
jQuery('a.gallery').fancybox();

E
exmmth, 2021-06-08
@exmmth

This is jQuery's default behavior in no-conflict mode jQuery. noConflict here is an answer on a similar topic explaining why jQuery and not $
Doesn't understand the $ character Jquery?
This is how to connect jquery to Joomla without jQuery.noConflict read more about how to disable on the forum https://joomlaforum.ru/index.php?topic=253684.0
JHtml::_('jquery.framework', false, null, false);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question