Getting a “jQuery(“a.raf_link”).fancybox is not a function” error?

My URL http://math.pixelworklab.com/.

In the top right there is an “Invite a friend” link that should open a fancybox but instead loads a new page.

Read More

In firefox console I see the following and cannot seem to nail the issue…

TypeError: jQuery("a.raf_link").fancybox is not a function
[Break On This Error]   

'titleShow' : false

TypeError: jQuery("a.single_image").fancybox is not a function
[Break On This Error]   

jQuery("a.single_image").fancybox();

Thanks!

Related posts

Leave a Reply

3 comments

  1. hey I saw your site view source.. You have include jquery library twice.Remove one and it will work

    <script type='text/javascript' src='http://math.pixelworklab.com/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>
    

    and

    <!-- include jQuery library -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    
  2. Looks like you have a problem because of two jQuery libraries attached. First is jquery 1.7.2 and second, stored on Google CDN, ver 1.5.2. fancybox is initialized after 1.7.2 and before 1.5.2

  3. I think you have to wrap your code (raf_script.js) in a document ready function:

    jQuery(document).ready(function() {
    
      $("a.raf_link").fancybox({
        'titleShow'     : false
      });
    
      ...
    
    });
    

    The jQuery have probably not been loaded before your script loads.