Hey Sean,
Thanks again man!
Just to make sure....I put this in the head of my document and then
add #nextLink to the Next link like this:
<a href="#" id="nextLink">Next</a>
and the #prevLink to the Previous link like this:
<a href="#" id="prevLink">Previous</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