My colorbox is throwing the following Javascript error whenever I click on a colorbox-enabled image on the home page:

$.data(this, colorbox) is undefined

The offending code (on line 208 of the uncompressed Javascript) is this:

var relRelated = $.data(this, colorbox).rel || this.rel; 

Strangely, the colorbox code works fine on individual node pages.

Comments

frjo’s picture

Do you have en example site where we can see this problem

Can you replicate it on a clean install.

jennifermontes’s picture

My site is live here: http://jennifermontes.com/

I'll try a clean install on my local machine and see what happens.

jennifermontes’s picture

Okay, I tried a clean install and Colorbox works fine... So that means there must be some kind of conflict with another module (*sigh*). I tried deactivating many of my modules and then clearing caches but no dice, so now I'm hunting around for where this could be coming from.

Starting from my original error in the Firebug console whenever I click on a Colorbox-enabled image: $.data(this, colorbox) is undefined. When I try the code without using the '$' shortcut, and specifying the 'colorbox' variable as 'jQuery.colorbox' I don't get an error anymore:

var relRelated = jQuery.data(this, jQuery.colorbox).rel || this.rel; 

If I try to put the code that's throwing the error inside some code that re-associates '$' with jQuery, like this:

jQuery(document).ready(function($) {
    var relRelated = $.data(this, colorbox).rel || this.rel; 
});

the console still complains, like so: ReferenceError: colorbox is not defined.

Honestly, I'm stumped. The lines previous to the one throwing the error use the '$' shortcut without any error and a few lines before that the 'colorbox' variable is being used without needing the 'jQuery.' prefix. What's happening? And why only on the front page?

frjo’s picture

Category: bug » support

A guess, but do you have some jQuery script that is not wrapped in:

(function ($) {

})(jQuery);
jennifermontes’s picture

Maybe, but how could I find it?

frjo’s picture

Deselect "Bandwidth optimization" for JavaScript files in the performance settings.

Look up all the JS files that are loaded on the front page.

Firefox with the Firebug plugin or Safari with the developer tools activated etc. are a good help in this.

frjo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.