View Full Version : How do I fix the error that I find from the Firebug plugin on Firefox?
kyle246
01-23-2012, 04:53 PM
After installing lightbox for my website my comments stopped working. I looked at the code and moved the javascript links that were in the <head> (the ones that came with lightbox) in the to above the javascript links that came with Wordpress-Buddypress. Before my javascript links from Lightbox were below the javascript links that came with Wordpress.
After making the switch, the comments started working again on my website but now the lightbox does not work.
When I use Firebug to find errors, I get this error.
$("#videogallery a[rel]").overlay is not a function
That code comes from "videolightbox.js" which was a file that came with my lightbox.
Any ideas on how to fix this problem?
Thanks.
weegillis
01-23-2012, 05:23 PM
If you are using more than one prototype library, there could be a conflict with $() syntax. Assuming the lightbox is written in jQuery, try changing the $() to jQuery().
kyle246
01-23-2012, 05:33 PM
If you are using more than one prototype library, there could be a conflict with $() syntax. Assuming the lightbox is written in jQuery, try changing the $() to jQuery().
In my videolightbox.js file, there is one line of code using jQuery it is
jQuery(function () {var $ = jQuery;var swfID = "video_overlay";if (!document.getElementById("vcontainer"))
the rest of the document is using $()
When I change all the $() to jQuery() I get a similar error
jQuery("#videogallery a[rel]").overlay is not a function
kyle246
01-23-2012, 08:05 PM
I took a look at the two jQuery files on that webpage.
The lightbox jQuery file is an older version than the one coming from Wordpress/Buddypress
I tried doing the fix located here
http://web.enavu.com/daily-tip/using-multiple-versions-of-jquery-on-the-same-page/
but it does not seem to work :/
weegillis
01-24-2012, 09:44 AM
No doubt this is a moot question, but I have to ask, is jQuery loaded?
Open the page. Hover on the outer edge and right click>inspect element
Switch to Console,
in the command line, type,
console.log(typeof jQuery);
it should return 'function'
DaveSawers
01-25-2012, 09:23 AM
Sounds more like a conflict inside the Javascript. If things work differently when you change bits of code around, then I would suspect you have two definitions of "overlay" within the Javascript, one as a variable and one as a function.
weegillis
01-25-2012, 01:37 PM
Sounds more like a conflict inside the Javascript. If things work differently when you change bits of code around, then I would suspect you have two definitions of "overlay" within the Javascript, one as a variable and one as a function.
Good point. Again, the OP can find more about this by querying it in console.log(), but also by doing a plain text search of the source code. As DaveSawers mentions, if there is a conflict, the last definition is the one that will stick. So if the result of your query returns 'object' then you know the variable has overwritten the function.