Fancybox is not a function

前端 未结 8 619
北海茫月
北海茫月 2020-12-16 10:40

Hello I am using the jQuery plugin fancybox to display bing maps when somebody enters an address into a textbox and hits the submit button beside it. And a fancybox is loade

相关标签:
8条回答
  • 2020-12-16 10:58

    If you are using a plugin which includes JQuery into your header tag, this trouble can arise. I recently added 'TheThe Slider' to my blog, all my FancyBoxes stopped working. There are easy fixes for this situation though. basically, go to the plugin directory, search for the call to jquery and make it's usage conditional. If you would like to see my implementation of this I did blog about it with screen-capture.

    0 讨论(0)
  • 2020-12-16 11:01

    In my case it was jQuery.noConflict(); row in another jQuery plugin ... when I removed everything started to work.

    0 讨论(0)
  • 2020-12-16 11:05

    I just had this issue, it seem some versions of jQuery are not compatible with versions of FancyBox, for example Fancybox 1.3.4 is buggy with jQuery versions below 1.7 and doesn't work on version higher than 1.8.

    0 讨论(0)
  • 2020-12-16 11:16

    Possible Solutions:

    1) have you already loaded jQuery? If not, then load it before any $ commands start.

    2) Check, probably you are loading jquery library (.js) several times during the page. Try to load only one.

    3) In the end of file, you can execute this javascript command: $ = jQuery.noConflict(); and it might solve. If not, then anywhere use the word jQuery instead of $, and it will work too.

    0 讨论(0)
  • 2020-12-16 11:16

    If "fancybox" as a function does not exist, it is likely that either the jQuery source or the plugin source are failing to load into your page. Make sure that the pathing, file names, and extension are all correct.

    EDIT: Make sure that you link to jQuery Source before you link to any plugins. If a plugin is loaded into your HTML before jQuery is, the plugin fails.

    0 讨论(0)
  • 2020-12-16 11:17

    I got this issue in my WordPress web site and I found the issue was happening due to fancybox.js presenting twice in the code from two plugins which I installed. So check your code and make sure to load from one source.

    0 讨论(0)
提交回复
热议问题