[jQuery] Re: Next / Previous Links

2007-05-18 Thread Bradley Holloway


Hey Sean,

Thanks again man!

Just to make sureI put this in the head of my document and then
add #nextLink to the Next link like this:

a href=# id=nextLinkNext/a

and the #prevLink to the Previous link like this:

a href=# id=prevLinkPrevious/a

Right?

Thanks,
Brad

- Original Message - 
From: Sean Catchpole [EMAIL PROTECTED]

To: jquery-en@googlegroups.com
Sent: Thursday, May 17, 2007 11:56 PM
Subject: [jQuery] Re: Next / Previous Links




Hi Brad,

I got the HTML from the link you posted. So try this (somewhere in 
head):


script type=text/javascript
var linklist = new Array();
var currlink = 0;
$(function(){
   $(#vidLinks, #vidLinks2, #vidLinks3, #vidLinks4).find(li
a).each(function(){
   linklist[linklist.length] = this.onclick;
   });
   $(#nextLink).click(function(){
   currlink=++currlink%linklist.length;  //This increments the
current image while wrapping around to the beginning again if it hit
the end of the list.
   eval(linklist[currlink]); //This runs the code to change the image.
   });
   $(prevLink).click(function(){
   currLink = (currLink)?--currLink:linklist.length //This
decrements and wraps if it hits beginning of list
   eval(linklist[currlink]); //This runs the code to change the image.
   });
});
/script

Let me know if you have any more questions.

~Sean






[jQuery] Re: Next / Previous Links

2007-05-18 Thread Sean Catchpole


Yup, you go it!

~Sean


[jQuery] Re: Next / Previous Links

2007-05-17 Thread Sean Catchpole


Hi Brad,

I got the HTML from the link you posted. So try this (somewhere in head):

script type=text/javascript
var linklist = new Array();
var currlink = 0;
$(function(){
   $(#vidLinks, #vidLinks2, #vidLinks3, #vidLinks4).find(li
a).each(function(){
   linklist[linklist.length] = this.onclick;
   });
   $(#nextLink).click(function(){
   currlink=++currlink%linklist.length;  //This increments the
current image while wrapping around to the beginning again if it hit
the end of the list.
   eval(linklist[currlink]); //This runs the code to change the image.
   });
   $(prevLink).click(function(){
   currLink = (currLink)?--currLink:linklist.length //This
decrements and wraps if it hits beginning of list
   eval(linklist[currlink]); //This runs the code to change the image.
   });
});
/script

Let me know if you have any more questions.

~Sean


[jQuery] Re: Next/Previous Links

2007-05-16 Thread Sean Catchpole


I was storing the onclick text, and eval() evaluates a string of
javascript. This means that the functions that would be executed on
click would instead be executed right then (at the eval).

I hope that helps.

~Sean