views:

43

answers:

2

I have a plugin where the original code is ...

// when the DOM is ready...
$(document).ready(function() {

var $panels = $('.slider .scrollContainer > div');
var $container = $('.slider .scrollContainer');

However this assumes that it just 'runs' when the DOM loads. I'd like to use it more like...

$('.slider').slider();

So my question is - how can I reference the given object in a plugin development? I've been searching around and most tutorials only cover hard-coded id's in plugin development.

+2  A: 

have you checked out this http://docs.jquery.com/Plugins/Authoring

Great explanation and gives you a base plugin template

Jonathan S.
Yes. It really doesn't address what I'm not understanding.
Stacey
+1  A: 

The results of the selector are available in a jQuery plugin through "this". So you would iterate over them $(this).each(function(idx,el){})

blockhead