PDA

View Full Version : Cmotion gallery numeric navigational buttons



blaster
08-12-2009, 05:30 AM
1) Script Title: Cmotion Image Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...iongallery.htm

3) Describe problem:

I'd like to find a way to create a function from a button that moves the gallery to a particular image. What I mean is that if I create a button with the label "3" on it the gallery to scroll to the 3rd image when that button is clicked.

Obviously it would be best if the gallery would automatically scroll to the image no matter where it already is, but even if I could have the gallery move all the way to the beginning first and then scroll a number of pixels to get to the image that would be fine too.

I guess what i'm saying is similar to this: http://cssglobe.com/lab/easyslider1.7/02.html but I would like it to be a continuous scroller rather than a step scroller.

Thank you so much in advance.

blaster
08-12-2009, 09:37 PM
So I figured it out myself I guess... or rather one way of doing it.

Added this function:

function moveto(number)
{
if (iedom&&parseInt(cross_scroll.style.left)<0){
cross_scroll.style.left=0+"px";
}
cross_scroll.style.left=parseInt(cross_scroll.style.left)-number*400+"px";
}

"number" could be the first, second, third, etc picture in the gallery
I'm assuming that the code here:
sets the start position back to 0, essentially back to the beginning
then moves the gallery negatively to the position of the pic (400 is the width of each pic).

Is there a better way of doing this? Also does anyone see any problems that I might get from this code? So far so good...