WordPress.org

Ready to get started?Download WordPress

Forums

Flickr Gallery
jQuery Error: flightbox not a function (8 posts)

  1. Benjamin Sommer
    Member
    Posted 2 years ago #

    Firefox 8.0 produced the following error with your plugin, while viewing a post:

    $("img.flickr.square,img.flickr.thumbnail,img.flickr.small").flightbox is not a function

    http://wordpress.org/extend/plugins/flickr-gallery/

  2. kwiliarty
    Member
    Posted 2 years ago #

    I was having the same problem. I believe that the answer and the solution are to be found here:

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers

    Looking at the code in the plugin file jquery.lightbox.js it seems that it is not using 'no-conflict' mode. I wrapped the JavaScript as described at the link above. Now the error is gone and the lightbox works.

  3. timmmmyboy
    Member
    Posted 2 years ago #

    I hate to sound like an idiot kwilliarty but would you be willing to give the dumbed down version of which code needs to be changed and what to change it to? I tried a few different things in that .js file but I still get the javascript error and it prevents other scripts on my page from working.

  4. timmmmyboy
    Member
    Posted 2 years ago #

    Fixed my own issue. Realized you were talking about the code in flickr-gallery.php and not the .js file. For those who see this (and maybe the developer) you need to do the following:

    In the file flickr-gallery.php Go to line 1431. You should see the following code:

    <script type="text/javascript">
    				(function($){
    					$(function(){
    						$("img.flickr.square,img.flickr.thumbnail,img.flickr.small").flightbox({size_callback: get_sizes});
    					});
    				})(jQuery);
    			</script>

    The developer meant to put it in no conflict mode at the beginning there but there's an extra $function line that is not necessary. Here is the proper code you can replace that section with that will not throw an error:

    <script type="text/javascript">
    				(function($){
    						$("img.flickr.square,img.flickr.thumbnail,img.flickr.small").flightbox({size_callback: get_sizes});
    					});(jQuery);
    			</script>
  5. kwiliarty
    Member
    Posted 2 years ago #

    Hi timmmmyboy,

    I was in fact talking about the jquery.lightbox.js. I wrapped the JavaScript in that file with these lines:

    jQuery(document).ready(function($) {
    ...
    });

    That change worked for me.

    I wonder if we are somehow looking at different versions of the code. (I have 1.5.2). I find the code you mention in flickr-gallery.php around line 1074. I don't have a line 1431. If I unmake my own change and apply the change you describe the lightbox stops working for me.

  6. naphznoudha
    Member
    Posted 2 years ago #

    hi keiliarty, how to put that code? i have the same problem

  7. kwiliarty
    Member
    Posted 2 years ago #

    You have to edit the file in the plugin folder. The path to the file withing the plugin folder is:

    /flightbox/jquery.flightbox.js

    The very beginning of the script that works for me (starting right after the commented head-matter) looks like this:

    jQuery(document).ready(function($) {
    ;(function($){
        $.flightboxIsVideo = false;

    where the very first line is the one that I added. The very bottom of my file looks like this:

    }
    })(jQuery);
    });

    where the very last line is the one that I added. Other solutions maybe be possible or better. At least for me, this does the trick.

  8. seanbelly
    Member
    Posted 2 years ago #

    I think I found an even better solution, find a plugin which works!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic