PDA

View Full Version : Fading Scroller - make it wait a second!!!



FionaSpence
04-06-2007, 10:53 AM
1) Script Title: Fading Scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/fadescroll.htm

3) Describe problem:
Hi wonderful people

I'd like to know if there's a way to make the fading scroller script hold off appearing on a page. Basically I've got a flash animation that takes about 10 sec to appear so to have two things flashing at once is a bit scary! Can anyone tell me if I can modify the code to have the scroller pause on page load? Or even appear as normal text, then have a <back next> button so users can see the next text at their leisure?

Many thanks in advance

Mrs Spence

mburt
04-07-2007, 03:06 PM
Give the begin tag an id, such as "myTag", and set it's style to display:none.
Place this in the body:

<script type="text/javascript">
var delay = 10000 // seconds
var el = document.getElementById("myTag");
setTimeout("el.style.display = 'block'",delay);
</script>
Hope this helps.

jscheuer1
04-07-2007, 03:10 PM
Untested:

To start it with a delay, change this:


if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

to:


function startWithDelay(){
setTimeout("changecontent()", 10000);
}

if (window.addEventListener)
window.addEventListener("load", startWithDelay, false)
else if (window.attachEvent)
window.attachEvent("onload", startWithDelay)
else if (document.getElementById)
window.onload=startWithDelay

The red 10000 is the number of milliseconds delay, 10000=10 seconds.

jscheuer1
04-07-2007, 03:59 PM
Here is a tested solution:

http://home.comcast.net/~jscheuer1/side/fade_scroller_oo.htm