diff options
Diffstat (limited to 'js/portfolio.js')
-rwxr-xr-x | js/portfolio.js | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/js/portfolio.js b/js/portfolio.js index 9e3f76f..f1ab1fb 100755 --- a/js/portfolio.js +++ b/js/portfolio.js | |||
@@ -1,26 +1,32 @@ | |||
1 | var sleep = function(ms, callback) { | 1 | var sleep = function(ms, callback) { |
2 | setTimeout(function() { | 2 | setTimeout(function() { |
3 | callback() | 3 | callback() |
4 | }, ms) | 4 | }, ms) |
5 | }, | 5 | }, |
6 | favthings = ["raspberrypi", "Linux", "Let's Encrypt", "Ingress"], | 6 | favthings = ["raspberrypi", "Linux", "Let's Encrypt", "Ingress", "Computer Vision", |
7 | removeClass = function(el, className) { | 7 | "Machine Learning"], |
8 | el.classList ? el.classList.remove(className) : el.className = el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ") | 8 | removeClass = function(el, className) { |
9 | }, | 9 | el.classList ? el.classList.remove(className) : el.className = |
10 | addClass = function(el, className) { | 10 | el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", |
11 | el.classList ? el.classList.add(className) : el.className += " " + className | 11 | "gi"), " ") |
12 | }, | 12 | }, |
13 | i = 0, | 13 | addClass = function(el, className) { |
14 | nextThing = function(thing) { | 14 | el.classList ? el.classList.add(className) : el.className += " " + className |
15 | i < favthings.length - 1 ? i++ : i = 0, removeClass(thing, "slideInDown"), addClass(thing, "slideOutUp"), sleep(700, function() { | 15 | }, |
16 | thing.innerHTML = favthings[i], removeClass(thing, "slideOutUp"), addClass(thing, "slideInDown") | 16 | i = 0, |
17 | }) | 17 | nextThing = function(thing) { |
18 | }; | 18 | i < favthings.length - 1 ? i++ : i = 0, removeClass(thing, "slideInDown"), |
19 | document.addEventListener("DOMContentLoaded", function() { | 19 | addClass(thing, "slideOutUp"), sleep(700, function() { |
20 | var thing = document.querySelectorAll(".favthing")[0]; | 20 | thing.innerHTML = favthings[i], removeClass(thing, "slideOutUp"), |
21 | setTimeout(function() { | 21 | addClass(thing, "slideInDown") |
22 | nextThing(thing) | 22 | }) |
23 | }, 1e3), setInterval(function() { | 23 | }; |
24 | nextThing(thing) | 24 | document.addEventListener("DOMContentLoaded", function() { |
25 | }, 4e3) | 25 | var thing = document.querySelectorAll(".favthing")[0]; |
26 | }); | 26 | setTimeout(function() { |
27 | nextThing(thing) | ||
28 | }, 1e3), setInterval(function() { | ||
29 | nextThing(thing) | ||
30 | }, 4e3) | ||
31 | }); | ||
32 | |||