It's all kind of already in the core:
rewind: $('...').parent().children(':first')
next()
key:
$.fn.key = function(){
return this.parent().children().index(this);
};
current: $('...').val()
valid : $('...').next().length
previous()
I probably misunderstood you, what's your objective?
- ricardo
On Nov 9, 6:44 pm, "Reinaldo \"JuniorZ\"" <[EMAIL PROTECTED]> wrote:
> I'm starting to work in a plugin to allow custom iterator methods to a
> jQuery object.
>
> The main idea is to be able to do something like this:
>
> (function($){
> //do some stuff having my custom iterator as default iterator
> //Can be a $(...).each() or $(...).rewind(), $(...).previous(),
> $(...).next(), etc})($.iterator({
>
> 'rewind': function(){...}, //Moves to the first element
> 'next': function(){...}, //Moves to the next element
> 'key': function(){...}, //Key of current element
> 'current': function(){...}, //Value of current element
> 'valid': fucntion(){...}, //Is the iterator valid (has a next
> element) ?
> 'previous': function(){...} //It Would be used to manipulate the
> iterator manually
>
> }));
>
> Or
>
> $('div').iterator({options}).each(function(){
> //do some stuff
>
> })
>
> Is there already any other plugin in dealing with this? Any comments or
> sugestions?
>
> --
> Reinaldo de Souza "JuniorZ"http://reinaldojunior.net
>
> -- Non ducor, duco
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---