/    Sign up×
Community /Pin to ProfileBookmark

Slideshow Script

I made a decent slideshow script for those who are interested:

[CODE]
<html>
<head>
<title>Javascript Messages</title>
<script language=”javascript”>
<!–
/*Script by: Savvy
You can edit and use this script freely. Do not sell or distribute however.
*/
/*variables to edit*/
var delay = 5000; /*milisecond delay*/
var max = 20; /*maximum number of slides, note if over 500 can be quite hard to detect*/
var prefix = ‘slide’; /*prefix of the ids for slides id=”m<i>”*/
/*other vaiables, do not touch*/
var items = 0;
var currentItem = 1;
function detect() {
for (i = 1; i <= max; i++) {
var temp = prefix+i;
var check = document.getElementById(temp);
if (check) {
items++;
}
}
}
function scroller(begin) {
if (begin == ‘1’) {
detect();
for (i = 2; i <= items; i++) {
var temp = prefix+i;
document.getElementById(temp).style.display = ‘none’;
}
}
var time = 1000; /*wait for 1 second initially, to let the page load*/
setTimeout(“scroll()”, time);
time += delay;
setTimeout(“scroll()”, time);
time += delay;
setTimeout(“scroller()”, time)
}
function scroll()
{
if (currentItem > items){ currentItem = 1; }
if (currentItem == 1) { last = items; }
else { last = currentItem-1; }
var temp = prefix+currentItem;
document.getElementById(temp).style.display = ‘block’;
document.getElementById(prefix+last).style.display = ‘none’;
currentItem++;
}
–>
</script>
<style>
.scroller
{
border: solid 2px #000000;
background-color: #cccc00;
width: 325px;
height: 125px;
overflow: scroll;
}
</style>
</head>
<body onload=”scroller(‘1’)”>
<!–REMOVE the ONLOAD event handler TO MAKE ALL MESSAGES VISABLE–>
<div id=”slide1″ class=”scroller”>
<p>Slide: <b>#1</b><br>
<b>Author of this crappy script:</b><br>
Savvy<br>
Here is some example content…</p>
</div>
<div id=”slide2″ class=”scroller”>
<p>Slide: <b>#2</b><br>
Here is some example content… waofhcvvaguvgvugavug</p>
</div>
<div id=”slide3″ class=”scroller”>
<p>Slide: <b>#3</b><br>
Here is some example content… awoihohuhyugawf</p>
</div>
<div id=”slide4″ class=”scroller”>
<p>Slide: <b>#4</b><br>
Here is some example content… awawfaffaawfawgga</p>
</div>
</body>
</html>
[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @savvykms 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.21,
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,
)...