Search code examples
javascripthtmlcolorbox

Colorbox not a method of object


I am fixing a bug on leefest.org.uk and I cannot get Colorbox working. Multiple people have worked on this project, so I apologise for the mess. Their are multiple plugins with multiple document ready functions.

As far as I can work out:

  • jQuery is being loaded before colorbox
  • Colorbox is being loaded before the colorbox call
  • The colorbox call is within a document ready function

Anyone?leefest colorbox error


Solution

  • This could happen if jQuery was being loaded twice. The first version of jQuery would be extended with the colorbox plugin. Including jQuery again would replace the original instance, and would not include colorbox.

    Most of the time I see this happening is when people load ajax content that includes a script element that sources the jQuery library, or they include a script in their main document that they do not realize has had jQuery included with it.