[jQuery] Re: Reorder list numerically based on attribute?

2009-11-24 Thread welshy1984
thats perfect,  so simple i feel a little silly i couldn't suss it out
myself.

thanks a million

On Nov 24, 4:54 am, Karl Swedberg  wrote:
> Something like this might work...
>
> var items = $('li').get();
> items.sort(function(a, b) {
>      var relA = +$(a).attr('rel');
>      var relB = +$(b).attr('rel');
>
>       if (relA > relB) { return 1; }
>       if (relA < relB) { return -1; }
>       return 0;});
>
> for (var i=0; i< items.length; i++) {
>      $('.list').append(items[i]);
>
> }
>
> --Karl
>
> ____
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Nov 23, 2009, at 8:21 PM, welshy1984 wrote:
>
> > I am wondering if it is possible to reorder a unordered list based on
> > the list items 'rel' attribute?
>
> > i have a list of items that change dynamically (its linked in with
> > google maps, the 'rel' attribute of the list item is updated with the
> > new distance from the google map marker icon when the marker is moved)
> > and i want it to update the list ordering each time a 'rel' attribute
> > changes.
>
> > i had a good look about, but i cant find anything for numerical
> > ordering (its all alphabetical) so im hoping somebody here could help?
>
> > my list essientially looks like this:
>
> > 
> > Place One
> > Place Two
> > Place Three
> > 
>
> > i'd be greatful for any help!


[jQuery] Reorder list numerically based on attribute?

2009-11-23 Thread welshy1984
I am wondering if it is possible to reorder a unordered list based on
the list items 'rel' attribute?

i have a list of items that change dynamically (its linked in with
google maps, the 'rel' attribute of the list item is updated with the
new distance from the google map marker icon when the marker is moved)
and i want it to update the list ordering each time a 'rel' attribute
changes.

i had a good look about, but i cant find anything for numerical
ordering (its all alphabetical) so im hoping somebody here could help?

my list essientially looks like this:


Place One
Place Two
Place Three


i'd be greatful for any help!


[jQuery] Cycle Plugin: Pause the cycle from link withing the cycling content?

2009-07-21 Thread welshy1984

I am having an issue with pausing the cycle from links within the
cycle.

I have set up a cycle that contains a html contentent including a
'video playlist'. This is a javascript based list that updates a flash
video player with a new video inside the cycle. The videos are loading
fine, but for some reason when i call the cycle 'pause', it dosent
work?

i have testing the $('#feature').cycle('pause'); from a link outside
the cycle and that seems to be working, but it seems to be from the
links inside the cycle content.

here is the code i am using (i have made a custom crossfade
transition)

function feature() {
$('#featuretitle').hide();
$('#feature').after(
''
).cycle({
fx: 'crossfade',
pause: 1,
speed: 1000,
timeout: 8000,
cleartype: 1,
pager: '#featurenav'
});
}

function videoList(){
$('a.vidlink').click(function(){
var vidLink = $(this).attr('rel');
player.sendEvent('STOP');
player.sendEvent('LOAD',vidLink);
player.sendEvent('PLAY');
$('#feature').cycle('pause');
});
}