Hi everybody, ok, I'm in a big trouble right now. Let me try to explain my problem :)
I'm trying to create a simple photo editing system. I need to define a DIV as the canvas, then to have many methods applicables to this object. My first reflex was to create a jQuery extension, something like this (just to give the idea): jQuery.Photo = { create: function(settings){ .... }), crop: function(...){ .... } }; jQuery.fn.extend( { Photo: jQuery.Photo.create, crop: jQuery.Photo.crop }); Very well, now I was able to create my editable photo by using $ ("#photo").Photo() and to crop by using $("#photo").crop() BUT, the problem is that I need to extend jQuery with every method I want to use on my photos. For example crop() is now in the global scope, and this is very ugly. To do well I should name it PhotoCrop, but this I don't find it's a good solution. What I would like is to have methods only usable on instances of the Photo object, in its local scope. For ex, in core javascript it would be like that: function Photo(){ ... } Photo.prototype.crop = function(){ ... } The problem is that I don't find any way to do this properly with jQuery. Maybe somebody here could help me? Many thanks in advance! Smaon