[jQuery] Help with plugin: a bind() / this problem...?
Hi folks,
I wondered if some kindly soul wouldn't take a glance at something for
me.
I recently wrote a Prototype extension called "Smart Lists" (http://
www.benjaminkeen.com/software/smartlists/) which I thought I'd convert
to jQuery. Mostly just to better familiarize myself with jQuery, but
also to open it up to more users.
I've implemented the plugin as a global function in the jQuery
namespace, called like so:
$.smartlist({options});
When running a single instance of it in a page (which, admittedly will
be what it will almost always be used for) the script works fine. But
when running two instances, the second "overwrites" the first. It
appears that my usage of "this" is perhaps incorrect - or perhaps the
want I bind the events to the object?
Here's an illustration of the problem. Try clicking on some thing in
the first instance (the left column) - you'll see it changes the
second.
http://www.benjaminkeen.com/software/smartlists/jquery_example.html
The code is here:
http://www.benjaminkeen.com/software/smartlists/jquery.smartlists.js
Any tips on what I'm doing wrong?
Thanks VERY much - I've been staring at this sucker for hours!
- Ben