WordPress.org

Support

Support » Plugins and Hacks » FancyBox for WordPress » [Plugin: FancyBox for WordPress] FancyBox plugin producing slightly invalid Javascript

[Plugin: FancyBox for WordPress] FancyBox plugin producing slightly invalid Javascript

  • 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…

Viewing 1 replies (of 1 total)
  • 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 ',';
                    }
                    $i++;
            }
    ?>
                            });        });

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: FancyBox for WordPress] FancyBox plugin producing slightly invalid Javascript’ is closed to new replies.
Skip to toolbar