Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: github-actions <github-actions@github.com>
- Loading branch information
github-actions
committed
Apr 16, 2024
1 parent
6105ff7
commit 5e3d311
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
layout: common | ||
title: Time | ||
permalink: /time | ||
--- | ||
|
||
<link rel="stylesheet" href="/assets/flipclock/flipclock.css"> | ||
<script src="/assets/flipclock/flipclock.js"></script> | ||
<div class="clock" style="margin-bottom:2em;margin-top:2em;display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0;"> | ||
</div> | ||
<!-- | ||
- Ajax @para counts | ||
- Jquery-return-value-undefined @link { https://stackoverflow.com/questions/13848123/jquery-return-value-undefined } | ||
--> | ||
<script> | ||
function setInitialCount() { | ||
var currentTime = new Date(); | ||
var hours = currentTime.getHours(); | ||
var minutes = currentTime.getMinutes(); | ||
var seconds = currentTime.getSeconds(); | ||
|
||
var totalSeconds = hours * 3600 + minutes * 60 + seconds; | ||
return totalSeconds; | ||
} | ||
|
||
var clock; | ||
let All_Counts = setInitialCount(); | ||
|
||
$(document).ready(function() { | ||
// Instantiate a counter | ||
clock = new FlipClock($('.clock'), All_Counts , { | ||
clockFace: 'HourlyCounter', // 使用 HourlyCounter 显示小时、分钟和秒数 | ||
}); | ||
|
||
// Attach a click event to a button an increment the clock | ||
$('.increment').click(function() { | ||
clock.increment(); | ||
}); | ||
|
||
// Attach a click event to a button a decrement the clock | ||
$('.decrement').click(function() { | ||
clock.decrement(); | ||
}); | ||
|
||
$('.reset').click(function() { | ||
clock.reset(); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters