FancyBox for WordPress
FancyBox plugin producing slightly invalid Javascript (2 posts)

  1. thesheep
    Posted 5 years ago #

    I noticed a JS error flag is raised in IE with this plugin.

    select.attr('rel', 'fancybox').fancybox({
    	'titlePosition'	: 'over',
    	'transitionIn'	: 'elastic',
    	'transitionOut'	: 'elastic',	});

    Looks like the final pair key/value has an extra comma at the end which shouldn't be there.

    I'm guessing you loop through these values somewhere in fancybox.php, so it would just be a question of amending that loop so it doesn't print out a comma on the final iteration...

  2. thesheep
    Posted 5 years ago #

    Maybe change the function in fancybox.php to use something like this instead:

    $i = 1;
            foreach ($easy_fancybox_array as $key => $values) {
                    $value = (get_option("fancybox_".$key)) ? get_option("fancybox_".$key) : $values['default'];
                    echo "
                                    '".$key."'      : '".$value."'";
                    if($i !== sizeof($easy_fancybox_array)) {
                            //We're not on the last iteration, so print a comma:
                            echo ',';
                            });        });

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • FancyBox for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic