Содержание
- Техническое обслуживание сайтов.
- Comments
- morrow95 commented Aug 4, 2016
- This comment has been minimized.
- tammyalexandra commented Jan 13, 2017
- This comment has been minimized.
- fancyapps commented Jan 13, 2017
- This comment has been minimized.
- Paulml1982 commented Feb 20, 2017
- This comment has been minimized.
- fancyapps commented Feb 20, 2017 •
- Техническое обслуживание сайтов.
- Comments
- morrow95 commented Aug 4, 2016
- This comment has been minimized.
- tammyalexandra commented Jan 13, 2017
- This comment has been minimized.
- fancyapps commented Jan 13, 2017
- This comment has been minimized.
- Paulml1982 commented Feb 20, 2017
- This comment has been minimized.
- fancyapps commented Feb 20, 2017 •
Техническое обслуживание сайтов.
Собственно, это может произойти не только в Virtuemart, этим может заболеть любой сайт, когда в нем накручивается много разных плагинов jQuery от разных фреймворков. Например, у меня (одного из моих клиентов) такая бяка полезла после того, как в шаблоне, сгенерированном Artisteer, начало конфликтовать практически все, что могло (Joomla 1.5 + Virtuemart 2.0 + шаблон от Artisteer = [closed censorship]).
Короче. Если вываливается что-то типа «.fancybox is not a function» — это говорит только о том, что где-то что-то конфликтует.
Для исправления подобных недоразумений придумано это:
В Artisteer это даже вынесено в отдельный файл . Убивал бы, да кодекс не дает…
Также существует большая вероятность того, что где-то переподключается jQuery или какой-то другой фреймворк. Такие дублированные подключения надо пресекать (найдите, убейте сами — тут все сильно индивидуально).
Итак, в моем случае, я, пофиксив дублирующиеся подключения фреймворков и путаницу в порядке подключения плагинов (убив, таким образом, другие попутные проблемы), добрался до файла /components/com_virtuemart/views/productdetails/tmpl/default_images.php
Там в строке 24 начинается следующее буйство:
Тут делаем следующий АП:
То есть, мы добавляем свой noConflict, с бэкджеком и разными тетями и его юзаем в своих корыстных целях. Добавляем
Заменяем jQuery на j$
Ну, вот, как-то так оно и происходит… В общем, если что-то где-то «is not a function» — это значит, что что-то где-то неправильно подключено, или конфликтует с соседями (юзаем noConflict).
Uncaught TypeError: jQuery(. ).html5lightbox is not a function
georgia.biz.ua/:216 Uncaught TypeError: jQuery(. ).fancybox is not a function
В консольку иногда заглядывайте, подключите его правильно, и будет вам счастье.
Comments
Copy link Quote reply
morrow95 commented Aug 4, 2016
Not sure exactly what is causing this, but it seems the ‘live’ option isn’t working with jquery 3. Same code and everything except using jquery 3.1.0 and the images open rather than fancybox opening. If I manually rerun my init command in the console all the links on the page work again :
Is there a line in the fancybox js that needs modified for jquery 3? Seeing as how my code hasn’t changed and it worked fine with jquery 2.x. just seems like the click handler no longer works and there is no binding to the class happening.
This comment has been minimized.
Copy link Quote reply
tammyalexandra commented Jan 13, 2017
I can’t get it to run at at with JQuery 3.1.1. If I switch to JQuery 2.2.4 — making no other code changes — it works.
This comment has been minimized.
Copy link Quote reply
fancyapps commented Jan 13, 2017
Would it be possible for you to update to v3?
This comment has been minimized.
Copy link Quote reply
Paulml1982 commented Feb 20, 2017
I have the same issue,
I’m upgrading my website from jquery v1.11 to jquery v3.1.1. Fancybox was version 2 and i installed version 3 of fancybox to work with v3.1.1. When dom elements are added by javascript with the class ‘fancybox’ the fancybox doesn’t work. Elements that are present on load work ok, no console log errors are thrown when the added dom element is clicked. It looks like the ‘live’ functionality doesn’t work correct.
The jquery 1.11 with older fancybox wersion work great also with the dynamic content.
This comment has been minimized.
Copy link Quote reply
fancyapps commented Feb 20, 2017 •
Right now, V3 supports «live» clicking only partly.
Источник: