Trying to force a fresh reload via show/hide divs and an animation event

Sonny Forelli

Well-known member
May 8, 2008
2,330
89
48
Liberty City
My situation is this.

I have a page where I'm using show/hide divs to walk a user through content (form).

At the end there is an animation event which in itself takes over and triggers the rest of the load (for lack of better terms).

My only issue is that as I am calling the animation and subsequent sequence via an iframe in a DIV that is hidden at first (and 'shown' via:

<button onclick='document.getElementById("lastpageofform").style.display="none";
document.getElementById("submissionanimation").style.display="block";'>SUBMIT</button>

the animation starts playing as soon as the page is loaded. This is problematic for me as if a user walks away or takes too long on the page they'll miss the animation that has been playing, yet is not visible yet due to (lack of) user interaction.

Is there a simple fix on this last button .js to force the 'submissionanimation' DIV to refresh/reload the iframe source contained within? If so this would totally solve my problem.

Thank you
 


This might work.

This is a timer script I made a while back that uses the JQuery load function to reload the contents of a div every so many milliseconds.

Code:
<script type="text/javascript"> function refreshDIV() {
        $("#ID").load("file.php", '', callback);
        }
        
        function callback() {
        setTimeout("refreshDIV();", 10000);
        }
        
        $(document).ready(refreshDIV);

</script>