about, bootcamps, certificate, course page, interview
This commit is contained in:
@@ -1023,3 +1023,302 @@
|
||||
initPathways();
|
||||
}
|
||||
})();
|
||||
|
||||
// ===== CERTIFICATION PAGE =====
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function initCertPage() {
|
||||
var page = document.querySelector('.cert-page');
|
||||
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (page.getAttribute('data-cert-init') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
page.setAttribute('data-cert-init', 'true');
|
||||
|
||||
var reduceMotion = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)'
|
||||
).matches;
|
||||
var isTouch = window.matchMedia(
|
||||
'(hover: none), (pointer: coarse)'
|
||||
).matches;
|
||||
|
||||
/* Pathway line fills in as the section scrolls into view. */
|
||||
var path = page.querySelector('.cert-path');
|
||||
|
||||
if (path) {
|
||||
if (reduceMotion || !('IntersectionObserver' in window)) {
|
||||
path.classList.add('is-lit');
|
||||
} else {
|
||||
var pathObserver = new IntersectionObserver(
|
||||
function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('is-lit');
|
||||
pathObserver.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ threshold: 0.35 }
|
||||
);
|
||||
|
||||
pathObserver.observe(path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Subtle 3D tilt on the certificate preview card. */
|
||||
var tiltCard = page.querySelector('[data-cert-tilt]');
|
||||
|
||||
if (tiltCard && !reduceMotion && !isTouch) {
|
||||
var MAX_TILT = 6;
|
||||
|
||||
tiltCard.addEventListener('mousemove', function (event) {
|
||||
var rect = tiltCard.getBoundingClientRect();
|
||||
var px = (event.clientX - rect.left) / rect.width - 0.5;
|
||||
var py = (event.clientY - rect.top) / rect.height - 0.5;
|
||||
|
||||
tiltCard.style.setProperty(
|
||||
'--cert-rx',
|
||||
(-py * MAX_TILT * 2).toFixed(2) + 'deg'
|
||||
);
|
||||
tiltCard.style.setProperty(
|
||||
'--cert-ry',
|
||||
(px * MAX_TILT * 2).toFixed(2) + 'deg'
|
||||
);
|
||||
});
|
||||
|
||||
tiltCard.addEventListener('mouseleave', function () {
|
||||
tiltCard.style.setProperty('--cert-rx', '0deg');
|
||||
tiltCard.style.setProperty('--cert-ry', '0deg');
|
||||
});
|
||||
}
|
||||
|
||||
/* Certificate FAQ accordion (one item open at a time). */
|
||||
var faqItems = Array.prototype.slice.call(
|
||||
page.querySelectorAll('.cert-faq__item')
|
||||
);
|
||||
|
||||
faqItems.forEach(function (item) {
|
||||
var trigger = item.querySelector('.cert-faq__trigger');
|
||||
var panel = item.querySelector('.cert-faq__panel');
|
||||
|
||||
if (!trigger) {
|
||||
return;
|
||||
}
|
||||
|
||||
trigger.addEventListener('click', function () {
|
||||
var wasOpen = item.classList.contains('is-open');
|
||||
|
||||
faqItems.forEach(function (other) {
|
||||
other.classList.remove('is-open');
|
||||
|
||||
var otherTrigger = other.querySelector('.cert-faq__trigger');
|
||||
var otherPanel = other.querySelector('.cert-faq__panel');
|
||||
|
||||
if (otherTrigger) {
|
||||
otherTrigger.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
if (otherPanel) {
|
||||
otherPanel.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
});
|
||||
|
||||
if (!wasOpen) {
|
||||
item.classList.add('is-open');
|
||||
trigger.setAttribute('aria-expanded', 'true');
|
||||
|
||||
if (panel) {
|
||||
panel.setAttribute('aria-hidden', 'false');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initCertPage);
|
||||
} else {
|
||||
initCertPage();
|
||||
}
|
||||
})();
|
||||
|
||||
// ===== ABOUT PAGE =====
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function initAboutPage() {
|
||||
var page = document.querySelector('.about-page');
|
||||
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (page.getAttribute('data-about-init') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
page.setAttribute('data-about-init', 'true');
|
||||
|
||||
var reduceMotion = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)'
|
||||
).matches;
|
||||
|
||||
/* Missing image fallbacks. */
|
||||
var images = Array.prototype.slice.call(page.querySelectorAll('img'));
|
||||
|
||||
images.forEach(function (img) {
|
||||
function markMissing() {
|
||||
var wrapper = img.parentElement;
|
||||
|
||||
if (wrapper) {
|
||||
wrapper.classList.add('is-missing');
|
||||
}
|
||||
}
|
||||
|
||||
img.addEventListener('error', markMissing);
|
||||
|
||||
if (img.complete && img.naturalWidth === 0) {
|
||||
markMissing();
|
||||
}
|
||||
});
|
||||
|
||||
/* Practical approach image: clip-path wipe + slow zoom. */
|
||||
var media = page.querySelector('.about-approach__media');
|
||||
|
||||
if (media) {
|
||||
if (reduceMotion || !('IntersectionObserver' in window)) {
|
||||
media.classList.add('about-inview');
|
||||
} else {
|
||||
var mediaObserver = new IntersectionObserver(
|
||||
function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('about-inview');
|
||||
mediaObserver.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ threshold: 0.25 }
|
||||
);
|
||||
|
||||
mediaObserver.observe(media);
|
||||
}
|
||||
}
|
||||
|
||||
/* Learning journey: connector line + badge sequence. */
|
||||
var journey = page.querySelector('.about-journey');
|
||||
|
||||
if (journey) {
|
||||
if (reduceMotion || !('IntersectionObserver' in window)) {
|
||||
journey.classList.add('about-lit');
|
||||
} else {
|
||||
var journeyObserver = new IntersectionObserver(
|
||||
function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('about-lit');
|
||||
journeyObserver.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ threshold: 0.3 }
|
||||
);
|
||||
|
||||
journeyObserver.observe(journey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initAboutPage);
|
||||
} else {
|
||||
initAboutPage();
|
||||
}
|
||||
})();
|
||||
|
||||
// ===== ABOUT FACULTY UPDATE =====
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function initFacultyTilt() {
|
||||
var grid = document.querySelector('.about-faculty-grid');
|
||||
var cards = document.querySelectorAll('.about-faculty-card');
|
||||
|
||||
if (!grid || !cards.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.getAttribute('data-about-faculty-tilt') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
grid.setAttribute('data-about-faculty-tilt', 'true');
|
||||
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
var isTouch = window.matchMedia('(hover: none), (pointer: coarse)').matches;
|
||||
|
||||
if (reduceMotion || isTouch) {
|
||||
return;
|
||||
}
|
||||
|
||||
Array.prototype.forEach.call(cards, function (card) {
|
||||
card.addEventListener('mousemove', function (event) {
|
||||
var rect = card.getBoundingClientRect();
|
||||
var px = (event.clientX - rect.left) / rect.width - 0.5;
|
||||
var py = (event.clientY - rect.top) / rect.height - 0.5;
|
||||
|
||||
card.style.setProperty('--rx', (-py * 8).toFixed(2) + 'deg');
|
||||
card.style.setProperty('--ry', (px * 8).toFixed(2) + 'deg');
|
||||
});
|
||||
|
||||
card.addEventListener('mouseleave', function () {
|
||||
card.style.setProperty('--rx', '0deg');
|
||||
card.style.setProperty('--ry', '0deg');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initFacultyTilt);
|
||||
} else {
|
||||
initFacultyTilt();
|
||||
}
|
||||
})();
|
||||
|
||||
// ===== ABOUT APPROACH: reveal =====
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var media = document.querySelector('.about-approach__media');
|
||||
var content = document.querySelector('.about-approach__content');
|
||||
if (!media || !content) return;
|
||||
|
||||
function show() {
|
||||
media.classList.add('about-inview');
|
||||
content.classList.add('is-visible');
|
||||
}
|
||||
|
||||
if (!('IntersectionObserver' in window)) {
|
||||
show();
|
||||
return;
|
||||
}
|
||||
|
||||
var io = new IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (entry.isIntersecting) {
|
||||
show();
|
||||
io.disconnect();
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.15 });
|
||||
|
||||
io.observe(media);
|
||||
io.observe(content);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user