Hi Brandon!

in your blog post you ask for suggested features.

Frankly i'm stunned by how in one line you addition all the widths values
(although i didn't expect less from you). Personally, I had to loop through
the returned array in order to achieve that.
Wouldn't it be a nice feature to add some built-in manipulations to the
batch? i'm thinking 'sum' to add them all and return the result, 'concat',
'join:,'  to join each with a comma in-between, 'average' to get the average
of all integer values, etc. a kind of built-in callbacks if you like for
most common operations.

$('li.hello img').widths('sum');


thank you!

alexandre


On Fri, May 9, 2008 at 5:01 PM, Brandon Aaron <[EMAIL PROTECTED]>
wrote:

>
> I misspelled reverse in my code example... It should be:
>
> var width = $('li.hello img').widths().sort().reverse()[0];
> $('li.hello').animate({ width: width }, 'slow');
>
> --
> Brandon Aaron
>
> On May 9, 9:47 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote:
> > Close but in your example newWidths is an array of numbers. In your case
> > you'll want a way to extract the largest width from the array and then
> use
> > that value to animate the li width. Maybe something like this.
> >
> > var width = $('li.hello img').widths().sort().revers()[0];
> > $('li.hello').animate({ width: width }, 'slow');
> >
> > Thanks for a nice "real-world" example. :)
> >
> > In testing this I found a bug and created a new release 1.0.1.
> >
> > --
> > Brandon Aaron
> >
> > On Fri, May 9, 2008 at 2:08 AM, Alexandre Plennevaux <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > > Brandon, i believe this is a clever little plugin. I i understand
> > > correctly, here is a real life example i experienced just 2 days ago
>  where
> > > i had such markup:
> >
> > > <li class="hello">
> > >                     <img width="316"
> src="photos/sombra/Image_001.jpg"/>
> > >                     <img width="629"
> src="photos/sombra/Image_002.jpg"/>
> > >                     <img width="630"
> src="photos/sombra/Image_003.jpg"/>
> > >                     <img width="638"
> src="photos/sombra/Image_004.jpg"/>
> > >                     <img width="631"
> src="photos/sombra/Image_005.jpg"/>
> > >                     <img width="630"
> src="photos/sombra/Image_006.jpg"/>
> > >                     <img width="629"
> src="photos/sombra/Image_007.jpg"/>
> > >                 </li>
> >
> > > I needed to resize the LI element according to its children IMG element
> > > attr width. What i did is loop through the jquery collection looking
> for the
> > > width attribute value.
> >
> > > with your plugin it would be just
> >
> > > var newWidth = $('li.hello').attrs('width');
> > > $('li.hello').animate({width: newWidth},"slow");
> >
> > > Am i correct?
> >
> > > On Fri, May 9, 2008 at 5:40 AM, Brandon Aaron <[EMAIL PROTECTED]
> >
> > > wrote:
> >
> > >> jQuery.batch is a small extension (951 bytes min'd, 520 bytes gzipped)
> to
> > >> jQuery that allows you to batch the results of any jQuery method,
> plugin
> > >> into an array. By default the batch plugin aliases the getter methods
> in
> > >> jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can
> also
> > >> just call $(...).batch('methodName', arg1, arg*n).
> >
> > >> Download:http://plugins.jquery.com/project/batch
> > >> Blog post:http://blog.brandonaaron.net/2008/05/08/jquery-batch/
> >
> > >> --
> > >> Brandon Aaron
> >
> > > --
> > > Alexandre Plennevaux
> > > LAb[au]
> >
> > >http://www.lab-au.com
>



-- 
Alexandre Plennevaux
LAb[au]

http://www.lab-au.com

Reply via email to