'this' confusion

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

'this' confusion

Sean Allen-5

working on my first plugin. which is:

jQuery.mplp = {
     setup:function( pages )
     {
         jQuery(document).ready(function(){
             for( index in pages )
             {
                 var page    = 'page_' + pages[ index ];
                 var nav     = '.nav_' + pages[ index ];
                 var hide    = index > 0 ? 1 : 0;
                 var options = 'group=pages,speed=1750,hide=' + hide;

                 animatedcollapse.addDiv( page, options );
                 jQuery.mplp.add_click_handler( nav, page );
             }

             animatedcollapse.init();
         });
     },
     add_click_handler:function( nav, page )
     {
         jQuery( nav ).click( function() {
             animatedcollapse.show( page );
             return false;
         });
     }
}

this works. however the jQuery.mplp.add_click_handler confuses me.
i thought i could do this.add_click_handler but that doesn't work.
it errors out with "this.add_click_handler is not a function"

can someone explain?

do I have to put the full namespace always?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---