Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Countdown page reload does not work properly #423

Open
qtapioca opened this issue Oct 22, 2022 · 0 comments
Open

Countdown page reload does not work properly #423

qtapioca opened this issue Oct 22, 2022 · 0 comments

Comments

@qtapioca
Copy link

qtapioca commented Oct 22, 2022

I downloaded and modified the countdown-to-new-years.html example by adding the stop function to display a message and a fix date time:

<html>
	<head>
		<link rel="stylesheet" href="../compiled/flipclock.css">

		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

		<script src="../compiled/flipclock.js"></script>	
	</head>
	<body>
		<div class="clock" style="margin:2em;"></div>

		<div class="message"></div>
		<script type="text/javascript">
			var clock;

			$(document).ready(function() {

				// Grab the current date
				var currentDate = new Date();

				// Set some date in the future 
				var futureDate  = new Date(2022, 9, 21, 20, 45);

				// Calculate the difference in seconds between the future and current date
				var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;

				// Instantiate a countdown FlipClock
				clock = $('.clock').FlipClock(diff, {
					clockFace: 'DailyCounter',
					countdown: true,
				    callbacks: {
						stop: function() {
							$('.message').html('The clock has stopped!');
		        	}
		        }
				});
			});
		</script>
		
	</body>
</html>

Issue:
When the countdown ends, reload the page does not display 00:00:00:00. Instead, it displayed -1-1-1-11- 1

Thanks in advance.

@qtapioca qtapioca changed the title Countdown with stop function does not work Countdown page reload does not work properly Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant