0

I have been looking around for an hour now trying to resolve this problem.

I run the latest version of Wordpress here

I think it has something to do with the jQuery being called the wrong way but as simple it might be, I have been looking at this for too long and I may be overseeing the simplest things. -.-

I use the wp head in the header section, deregistering the Wordpress jQuery and adding my own. It used to be the one from Google APIs that is now called below in the actual body - a deperate try to make things work.

I also downloaded the old 1.2 version found on the Easing Plugins website in a viciously furiously attempt.

It would be lovely if someone could hit me in the head, preferably with something hard, clarifying the stupidity of my coding flaw.

Thank you!

Also, failed to mention that it actually worked until a week ago.

EDIT: This is the functions.php - maybe that will help?

<?php
function emmatheme_scripts() {

//deregisters the Wordpress included jquery
wp_deregister_script( 'jquery' );

//adds own jquery
wp_register_script( 'jquery2', 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js');
wp_enqueue_script( 'jquery2' );
wp_enqueue_script( 'easing', get_template_directory_uri() . '/js/easing.js', 'jquery2' );

//Fancybox
wp_enqueue_script( 'fancy2', get_template_directory_uri() . '/js/fb2.js', 'jquery2' );
wp_enqueue_script( 'fancy3', get_template_directory_uri() . '/js/fb3.js', 'jquery2' );

}    

add_action('init', 'emmatheme_scripts');

?>
Christian
  • 111
  • 1
  • 1
  • 9
  • You don't have the Fancybox plugin on your page..This needs to go after you've loaded the jQuery plugin at the bottom of your page. – kayen Jan 28 '13 at 08:38
  • Thank you for the answer, @kayen. It _should_ be called in the header section as fb.js? – Christian Jan 28 '13 at 08:40
  • 1
    You have two choices: 1. Rollback to jQuery v1.8.3 ...or 2. Patch your fancybox v1.3.4. why? because fancybox (v1.3.4 or lower AND v2.1.3 or lower) doesn't work with jQuery 1.9.0. Check this for more http://stackoverflow.com/q/14344289/1055987 – JFK Jan 28 '13 at 19:36
  • Thank you very much! I knew it :P I thought it was some jQuery versioning but wasn't sure. Please answer, and you'll get point. – Christian Jan 29 '13 at 09:18

1 Answers1

1

Please try this :

(function($){
            $(document).ready(function(){
                $("a.gallery_fancybox]").fancybox({
                    'transitionIn'      : 'elastic',
                    'transitionOut'     : 'elastic',
                    'titlePosition'     : 'inside',
                    'speedIn'                   :   500, 
                    'speedOut'              :   300,
                    'titleFormat'           : function(title, currentArray, currentIndex, currentOpts) {
                        return '<span id="fancybox-title-inside">&copy; Fotografi af Thomas Kj&aelig;r Nielsen </span>';
                    },
                    'onComplete':   function() {
                        clearTimeout(jQuery.fancybox.slider);
                        jQuery.fancybox.slider=setTimeout("jQuery.fancybox.next()",2000);
                    }               });
            });
        })(jQuery);

also remove this from your code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

as you already included the jquery file in the header of the site.

Regards.

Himanshu Jain
  • 444
  • 1
  • 8
  • 23