|
|
@@ -284,6 +284,10 @@
|
|
|
var dots = Array.prototype.slice.call(root.querySelectorAll(dotSelector));
|
|
|
var index = 0;
|
|
|
var timer = 0;
|
|
|
+ var carouselInterval = interval;
|
|
|
+ if (document.body.classList.contains("screen-red-theme") && root.classList.contains("screen-hero-frame")) {
|
|
|
+ carouselInterval = 6000;
|
|
|
+ }
|
|
|
|
|
|
function show(next, direction) {
|
|
|
var previousIndex = index;
|
|
|
@@ -310,6 +314,7 @@
|
|
|
}, 1200);
|
|
|
}
|
|
|
});
|
|
|
+ restartScreenHeroZoom(root, items, index);
|
|
|
dots.forEach(function (dot, dotIndex) {
|
|
|
dot.classList.toggle(activeClass, dotIndex === index);
|
|
|
});
|
|
|
@@ -320,7 +325,7 @@
|
|
|
stop();
|
|
|
timer = window.setInterval(function () {
|
|
|
show(index + 1, 1);
|
|
|
- }, interval);
|
|
|
+ }, carouselInterval);
|
|
|
}
|
|
|
|
|
|
function stop() {
|
|
|
@@ -346,6 +351,32 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function restartScreenHeroZoom(root, items, activeIndex) {
|
|
|
+ if (!document.body.classList.contains("screen-red-theme") || !root.classList.contains("screen-hero-frame")) return;
|
|
|
+ if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
|
+ var activeItem = items[activeIndex];
|
|
|
+ if (!activeItem) return;
|
|
|
+ items.forEach(function (item) {
|
|
|
+ item.classList.remove("is-zooming");
|
|
|
+ });
|
|
|
+ if (root._screenHeroZoomFrame) {
|
|
|
+ if (window.cancelAnimationFrame) {
|
|
|
+ window.cancelAnimationFrame(root._screenHeroZoomFrame);
|
|
|
+ } else {
|
|
|
+ window.clearTimeout(root._screenHeroZoomFrame);
|
|
|
+ }
|
|
|
+ root._screenHeroZoomFrame = 0;
|
|
|
+ }
|
|
|
+ activeItem.offsetWidth;
|
|
|
+ var nextFrame = window.requestAnimationFrame || function (callback) {
|
|
|
+ return window.setTimeout(callback, 16);
|
|
|
+ };
|
|
|
+ root._screenHeroZoomFrame = nextFrame(function () {
|
|
|
+ activeItem.classList.add("is-zooming");
|
|
|
+ root._screenHeroZoomFrame = 0;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function setupStudyPanelFit() {
|
|
|
var carousel = document.querySelector(".colorful-carousel");
|
|
|
var panel = document.querySelector(".study-panel");
|