/    Sign up×
Community /Pin to ProfileBookmark

I can’t make it stop

Hi, I have a slideshow displaying 10 or so images. I want the show to stop at the last image, and start again if the last image is clicked.
here is the sample [url]http://www.amynnasser.com/home4.htm[/url]

any help would be greatly appreciated

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@PittimannAug 02.2004 — Hi!

The image tag quite at the bottom:

<img src="images/sparks/change_0.gif" width="500" height="250" name="pic" onclick="if(loopIt==1){loopIt=0;cycle()}">
------


The cycle function and the variables above:

var x=0;

var loopIt=0;

var imagenum=11;

var pic=imageson[0][0]

function cycle(){

x++;

var pic=document.pic.src=imageson[0][x];

if (x<imagenum){

var timer=setTimeout("cycle(pic)", 300);

}

if (x==10){

loopIt=1;

x=0;

clearTimeout(timer)

}

}
------


The new variable:

var loopIt=0;

is essential!
------


Cheers - Pit
Copy linkTweet thisAlerts:
@sandipearauthorAug 02.2004 — thank you so much!
Copy linkTweet thisAlerts:
@PittimannAug 02.2004 — Hi!

You're welcome! ?

Regards - Pit
×

Success!

Help @sandipear spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...