Hi Rene,

I've never quite understood the benefits to the plugin approach, when
you can simply create an object that uses jquery.

(I've wondered about this before on the list, but so far no one has
enlightened me.)

function Animator(container) {
  this.jC = container; // this is a jquery instance
};

Animator.prototype.draw = function() {
  this.jC.html('<div>draw some elements</div>');
  this.jC.find('div').click(function() { alert('add some
events'); });
};

Then you can create as many objects as you need.

var a1 = new Animator($('#img1'));
var a2  = new Animator($('#img2'));

etc.

Works great and seems (to me) much simpler than creating a plug-in.

-j

On Apr 19, 5:40 am, "Rene Veerman" <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I've created a button jquery plugin that does a png animation onhover, and
> takes text on the button from html/dom.
> Although i've modelled the code after the datePicker plugin, and it works, i
> think i have a problem with scope. When I instantiate buttons in two
> different windows, a click in the first window uses settings from the second
> window. :(
>
> I'd like some advice on the code i've written. If there are any tutorials
> about jquery plugin writing that you can recommend, i'd like to read those
> aswell.
>
> The code can be downloaded 
> throughthttp://mediabeez.ws/mediaBeez/permalink.php?tag=buttonAnimated

Reply via email to