aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJinwei Zhao <[email protected]>2016-04-04 16:26:11 +0800
committerJinwei Zhao <[email protected]>2017-01-13 15:07:46 +0800
commitf687e2803ed53493a03525adc542254151fc6579 (patch)
tree94c295a3986c5261930a1dbf607183fd6e359a4f /js
parente002d09d2b6b2317fec6caa8836b20e6709c5da3 (diff)
downloadjinwei.me-f687e2803ed53493a03525adc542254151fc6579.tar.gz
Delete CNAME
Diffstat (limited to 'js')
-rwxr-xr-xjs/portfolio.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/portfolio.js b/js/portfolio.js
new file mode 100755
index 0000000..9e3f76f
--- /dev/null
+++ b/js/portfolio.js
@@ -0,0 +1,26 @@
1var sleep = function(ms, callback) {
2 setTimeout(function() {
3 callback()
4 }, ms)
5 },
6 favthings = ["raspberrypi", "Linux", "Let's Encrypt", "Ingress"],
7 removeClass = function(el, className) {
8 el.classList ? el.classList.remove(className) : el.className = el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ")
9 },
10 addClass = function(el, className) {
11 el.classList ? el.classList.add(className) : el.className += " " + className
12 },
13 i = 0,
14 nextThing = function(thing) {
15 i < favthings.length - 1 ? i++ : i = 0, removeClass(thing, "slideInDown"), addClass(thing, "slideOutUp"), sleep(700, function() {
16 thing.innerHTML = favthings[i], removeClass(thing, "slideOutUp"), addClass(thing, "slideInDown")
17 })
18 };
19document.addEventListener("DOMContentLoaded", function() {
20 var thing = document.querySelectorAll(".favthing")[0];
21 setTimeout(function() {
22 nextThing(thing)
23 }, 1e3), setInterval(function() {
24 nextThing(thing)
25 }, 4e3)
26});
Powered by cgit v1.2.3 (git 2.41.0)