Why am I getting a syntax error in JavaScript?

<script type="text/javascript">
  $(document).ready(function(){
    $("a.grouped_elements").fancybox(
       'transitionIn' : 'elastic',
       'transitionOut' : 'elastic',
       'speedIn' : 600,
       'speedOut' : 200, 
       'overlayShow' : false );
  });
</script>

I am getting the error: missing ) after argument list on this section of code using firefox 3.6.12. The gallery still works but I get the error in fox and IE. No error in chrome though.

Upvotes: 0

Views: 445

Answers (4)

Ahmed
Ahmed

Reputation: 1

u are missing {} i have put it between xx xx

<script type="text/javascript">
  $(document).ready(function(){
    $("a.grouped_elements").fancybox( xx{xx
       'transitionIn' : 'elastic',
       'transitionOut' : 'elastic',
       'speedIn' : 600,
       'speedOut' : 200, 
       'overlayShow' : false xx}xx);
  });
</script>

Upvotes: 0

danjah
danjah

Reputation: 3059

$("a.grouped_elements").fancybox( **{**'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : false ); });

You're missing a curly brace to open and close your set of object properties.

Upvotes: 0

wajiw
wajiw

Reputation: 12269

Should be: $(document).ready(function(){ $("a.grouped_elements").fancybox( {'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : false }); });

Upvotes: 0

Nick Craver
Nick Craver

Reputation: 630429

You're missing the { and } around your options object you're passing to .fancybox().

 $(document).ready(function(){
    $("a.grouped_elements").fancybox({
                                     ^ here
       'transitionIn' : 'elastic',
       'transitionOut' : 'elastic',
       'speedIn' : 600,
       'speedOut' : 200, 
       'overlayShow' : false 
    });
    ^ and here
 });

Upvotes: 8

Related Questions