Title: [Plugin: FancyBox for WordPress] FancyBox plugin producing slightly invalid Javascript
Last modified: August 19, 2016

---

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

 *  [thesheep](https://wordpress.org/support/users/thesheep/)
 * (@thesheep)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/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)

 *  Thread Starter [thesheep](https://wordpress.org/support/users/thesheep/)
 * (@thesheep)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-fancybox-for-wordpress-fancybox-plugin-producing-slightly-invalid-javascript/#post-1692659)
 * 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.

 * ![](https://ps.w.org/fancybox-for-wordpress/assets/icon-256x256.jpg?rev=1864321)
 * [FancyBox for WordPress](https://wordpress.org/plugins/fancybox-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fancybox-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fancybox-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/fancybox-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fancybox-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [thesheep](https://wordpress.org/support/users/thesheep/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-fancybox-for-wordpress-fancybox-plugin-producing-slightly-invalid-javascript/#post-1692659)
 * Status: not resolved