PDA

View Full Version : Stopping a rotating image script from looping


mikeskin
04-01-2010, 12:33 AM
Hi,

***PLEASE NOTE THAT I REPOSTED THIS IN THE JQUERY FORUM AT THE RECOMMENDATION OF ONE OF THE SENIOR MEMBERS OF THIS FORUM**

I am working with a template I purchased that will loop a series of header images. I like to stop the image series from going back to the beginning once the series of images cycles through.

For instance, if there were 3 images in the sequence; currently the script cycles through all 3 images and then starts from the beginning. I would like the script to stop on the last image (so that image stays displayed) and not start the sequence again from the beginning. I couldn't get any support for hacking this script from the developers.

Here is the relevant code:


<script type='text/javascript'>
/* <![CDATA[ */
jQuery(document).ready(
function() {
jQuery('#featured-images-rotator').crossSlide(
{sleep: <?php echo $this->_options['sleep']; ?>, fade: <?php echo $this->_options['fade']; ?><?php echo $target; ?>},
[
<?php echo "$list\n"; ?>
]
);
}
);
/* ]]> */
</script>


I am attaching the original file where this snippet of code was extracted from.

Thanks for looking at this.

VIPStephan
04-01-2010, 02:01 AM
I just looked at the crossSlide website, and look what I found:


You can have the animation loop just once, or a fixed number of times, by adding a loop option to the first parameter, alongside fade, sleep or speed.

mikeskin
04-01-2010, 06:50 AM
That was great, thanks for pointing that out. I looked it over but do not know how to edit that code to get the images to go through the sequence and stop. Can you kindly provide and example?

Thanks

VIPStephan
04-01-2010, 11:21 AM
This line:
{sleep: <?php echo $this->_options['sleep']; ?>, fade: <?php echo $this->_options['fade']; ?><?php echo $target; ?>},

add loop: 1 somewhere in there (I suppose loop goes with a number for the times to loop through), like so:

{loop: 1, sleep: <?php echo $this->_options['sleep']; ?>, fade: <?php echo $this->_options['fade']; ?><?php echo $target; ?>},

mikeskin
04-02-2010, 06:10 AM
Well that did it and I am really appreciative of the assistance. Thanks for making my life a whole lot easier. I will post this solution in the developers forum so that someone else will benefit from this as well.

Thanks again