move ityped to js asset, implement experiences horizontal vertical line in css

This commit is contained in:
Aaron Qian 2022-11-11 10:47:14 -08:00 committed by Aaron Qian
parent 97d60b44d9
commit a06ee73c4a
No known key found for this signature in database
GPG key ID: BF1A987C395B5B0E
4 changed files with 26 additions and 48 deletions

View file

@ -0,0 +1,16 @@
import {init} from 'ityped';
// =========== Typing Carousel ================
// get data from hidden ul and set as typing data
document.addEventListener('DOMContentLoaded', () => {
$ul = document.getElementById('typing-carousel-data')?.children;
if($ul == null || $ul.length === 0) return;
const strings = Array.from($ul).map($el => $el.textContent);
init('#ityped', {
strings,
startDelay: 200,
loop: true
});
});

View file

@ -1,3 +1,4 @@
import './note';
import './search';
import './single';
import './home';

View file

@ -47,7 +47,7 @@
left: 50%;
}
.vertical-line-left-adjustment::after {
.timeline .vertical-line:nth-child(even)::after {
left: calc(50% - 3px) !important;
}
@ -75,26 +75,26 @@
border-radius: 15px;
}
.top-left {
left: -50%;
top: -50%;
}
.top-right {
.timeline .row:nth-child(2n) div:nth-child(1) .corner {
left: 50%;
top: -50%;
}
.bottom-left {
.timeline .row:nth-child(2n) div:nth-child(3) .corner {
left: -50%;
top: calc(50% - 3px);
}
.bottom-right {
.timeline .row:nth-child(4n) div:nth-child(1) .corner {
left: 50%;
top: calc(50% - 3px);
}
.timeline .row:nth-child(4n) div:nth-child(3) .corner {
left: -50%;
top: -50%;
}
/* ============= Device specific fixes ======= */
/* Large screens such as TV */

View file

@ -24,45 +24,6 @@ var projectCards, publicationCards;
}
detectDevice();
// =========== Typing Carousel ================
// get data from hidden ul and set as typing data
if (document.getElementById('typing-carousel-data') != undefined) {
var ul = document.getElementById('typing-carousel-data').children;
if (ul.length != 0) {
var data = [];
Array.from(ul).forEach(el => {
data.push(el.textContent);
})
ityped.init('#ityped', {
strings: data,
startDelay: 200,
loop: true
});
}
}
// ============== Fix Timelines Horizontal Lines =========
var hLines = document.getElementsByClassName("horizontal-line");
for (let i = 0; i < hLines.length; i++) {
if (i % 2) {
hLines[i].children[0].children[0].classList.add("bottom-right");
hLines[i].children[2].children[0].classList.add("top-left");
} else {
hLines[i].children[0].children[0].classList.add("top-right");
hLines[i].children[2].children[0].classList.add("bottom-left");
}
}
// ============== Fix Timelines Vertical lines =========
var vLines = document.getElementsByClassName("vertical-line");
for (let i = 0; i < vLines.length; i++) {
if (i % 2) {
vLines[i].classList.add("vertical-line-left-adjustment");
}
}
// ================== Project cards =====================
// Add click action on project category selector buttons