If you have no reason to chain your plugin (something like $ ('#photo').photo(...).css(...).attr(...) then having it return a different object makes sense. But then, why put it in the jQuery namespace at all? 'return new smaon.photo(...) makes as much sense. Danny
On Dec 12, 10:38 am, Smaon <[EMAIL PROTECTED]> wrote: > Thank you for your answer Danny. > > I'm currently trying this way: > > jQuery.fn.photo = function (...) { > var canvas = $(this).get(0); > return new jQuery.photo(canvas, settings); > > } > > jQuery.twistMap = function(canvas, settings){ > //create code > > this.crop = function(){ > ...... > } > > } > > usable like this: > > var photo = $("#photo").photo(...); > photo.crop(); > > What do you think? For me, while not being perfect, it seems more or > less ok... > > PS: BTW, it there a way to put clean code in this discussion group? >