On 11/25/06, Michael Geary <[EMAIL PROTECTED]> wrote:
>
> So what was *really* missing here was a comma, not a semicolon - because the
> function definitions were all supposed to be part of that one "var"
> statement.
>
> Instead, the JavaScript interpeter sees that it can't parse the code as is,
> and it inserts a semicolon after "settings" - thus cutting off the function
> definitions from the "var" statement.
>
> The code still runs, but all those assignments have become globals instead
> of locals. Oops!
>

My bad, I didn't fully understand that long var definition.
Thx for your detail explain!

>
> Or maybe just:
>
> (function($) {
>
>     var
>     ...
>     modalCloseBtn,
>     settings;
>
>     $.fn.Modal = function(defaultSettings) {
>         ...
>     };
>
>     function modal_handle(event) {
>         ...
>     }
>
>     ...
>
>     function modal_close(event) {
>         ...
>     }
>
>     $.fn.Modal.defaults = {
>         event: "",
>         after: null,
>         ...
>         shadowOffset: 5
>     };
>
> })(jQuery);
>

I'll update my code to adopt this simple structure.  :- )

Thanks everyone.

-- 
Regards,
epaulin

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to