I am completing a new plugin where I have a function JSON option to
fade in instead of just show().  So the code is:

         settings.fadeIn?$box.fadeIn():$box.show();

settings.fadeIn is passed as a true or false value in the plugin
function settings parameter:

    var settings = {
         ...
         fadeIn : true,
         ....
      };

What I prefer is to define the option as a string:

    var settings = {
         ...
         show:: "fadeIn",    // default is .show()
         ....
      };

and apply it accordingly.

The only way I can think of doing it is with eval(), which I prefer
not to if there is another way:

     var how = (settings.show!="")?settings.show:"show";
     eval("$box."+how+"()");

Is this the only way?

Thanks

--
HLS

Reply via email to