> From: Pops
>
> How do you passing parameters via the settings?
>
> An example is passing the speed
>
> var settings = {
> ...
> show: "slideDown(50)",
> ...
> };
>
> I get a syntax error for:
>
> $box[ settings.show || 'show' ]();
>
> I guess I have to passing the parameter as setting?
>
> var settings = {
> ...
> show: "slideDown".
> speed: 50,
> ...
> };
>
> $box[ settings.show || 'show' ](settings.speed);
>
> Correct?
Makes sense to me. There are a few ways you could organize this, but that's
as good as any depending on your needs.
The first example failed because it was equivalent to:
$box[ slideDown(50) ]();
which *could* be valid code (if slideDown were a function that returned a
string containing a method name) but would be unlikely to be what you
wanted.
-Mike