|
|
@@ -1,113 +1,130 @@
|
|
|
-const studioCarouselElement = document.querySelector('#caro')
|
|
|
-const carousel = new bootstrap.Carousel(studioCarouselElement, {
|
|
|
- interval: 5000,
|
|
|
- wrap: true
|
|
|
-});
|
|
|
+// Studio page — vanilla fade-carousel + tab sync + per-slide choreography.
|
|
|
+// Replaces Bootstrap Carousel/Tab, jQuery, and backstretch. Keeps DrawFillSVG
|
|
|
+// (window.DrawFillSVG, self-exposed from the v4-script bundle).
|
|
|
|
|
|
-jQuery(document).ready(function($) {
|
|
|
-
|
|
|
- $('.nav-toggle').on('touchstart click', function(e) {
|
|
|
- e.preventDefault();
|
|
|
- $( this ).toggleClass( 'active' );
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- $(function dw_hidenav() {
|
|
|
- var headerHeight = $('.navbar').height();
|
|
|
- $(window).on('scroll', { previousTop: 0 },
|
|
|
- function() {
|
|
|
- var currentTop = $(window).scrollTop();
|
|
|
- if (currentTop < this.previousTop) {
|
|
|
- if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
|
|
|
- $('.navbar').addClass('visible');
|
|
|
- $('.site-title a').removeClass('light');
|
|
|
- } else {
|
|
|
- $('.navbar').removeClass('visible fixed');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- $('.navbar').removeClass('visible');
|
|
|
- if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
|
|
|
- }
|
|
|
- this.previousTop = currentTop;
|
|
|
+// --- shared chrome: navbar hide/show on scroll (ported from jQuery dw_hidenav) ---
|
|
|
+(function () {
|
|
|
+ const navbar = document.querySelector('.navbar');
|
|
|
+ if (!navbar) return;
|
|
|
+ const title = document.querySelector('.site-title a');
|
|
|
+ const headerHeight = navbar.offsetHeight;
|
|
|
+ let previousTop = 0;
|
|
|
+ window.addEventListener('scroll', function () {
|
|
|
+ const currentTop = window.scrollY;
|
|
|
+ if (currentTop < previousTop) {
|
|
|
+ if (currentTop > 0 && navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('visible');
|
|
|
+ if (title) title.classList.remove('light');
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible', 'fixed');
|
|
|
+ if (title) title.classList.add('light');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible');
|
|
|
+ if (currentTop > headerHeight && !navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('fixed');
|
|
|
}
|
|
|
- );
|
|
|
+ }
|
|
|
+ previousTop = currentTop;
|
|
|
+ }, { passive: true });
|
|
|
+})();
|
|
|
+
|
|
|
+document.querySelectorAll('.nav-toggle').forEach(function (el) {
|
|
|
+ el.addEventListener('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ el.classList.toggle('active');
|
|
|
});
|
|
|
+});
|
|
|
|
|
|
+// --- studio fade-carousel ---
|
|
|
+(function () {
|
|
|
+ const stage = document.getElementById('studio-caro');
|
|
|
+ const caro = document.getElementById('caro');
|
|
|
+ if (!stage || !caro) return;
|
|
|
|
|
|
- $("#studio-caro").backstretch("../wp-content/themes/daw/img/studio-26.jpg");
|
|
|
- $('#caro').on('slid.bs.carousel', function(e) {
|
|
|
- var consta = e.to;
|
|
|
- console.log('target: ' + consta );
|
|
|
- setTimeout(function() {
|
|
|
- if (consta === 0) {
|
|
|
- $('a[href="#studio"]').tab('show')
|
|
|
- $('#studio-caro').addClass('caro-grad5').removeClass('caro-grad caro-grad3 caro-grad2 caro-grad5');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- $('.carousel-indicators li').removeClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch({url:'../wp-content/themes/daw/img/studio-26.jpg', fade: 250 });
|
|
|
- }
|
|
|
- if (consta === 1) {
|
|
|
- $('a[href="#webdev"]').tab('show')
|
|
|
- $('.active #svg-imac.screen').delay(2500).queue(function(screenit){
|
|
|
- $(this).attr('class', 'bg');
|
|
|
- screenit();
|
|
|
- });
|
|
|
- $('#studio-caro').addClass('caro-grad').removeClass('caro-grad3 caro-grad2 caro-grad5');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- $('.carousel-indicators li').removeClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch('destroy');
|
|
|
- }
|
|
|
- if (consta === 2) {
|
|
|
- $('a[href="#ux"]').tab('show')
|
|
|
- $('#studio-caro').addClass('caro-grad2').removeClass('caro-grad caro-grad3 caro-grad5');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- $('.carousel-indicators li').removeClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch('destroy');
|
|
|
- }
|
|
|
- if (consta === 3) {
|
|
|
- $('a[href="#graphic"]').tab('show')
|
|
|
- $( '#studio-caro' ).addClass('caro-grad3').removeClass('caro-grad2 caro-grad caro-grad5');
|
|
|
- $('.site-title a').removeClass('light');
|
|
|
- $('.carousel-indicators li').addClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch('destroy');
|
|
|
- }
|
|
|
- if (consta === 4) {
|
|
|
- $('a[href="#media"]').tab('show')
|
|
|
- $('#studio-caro').removeClass('caro-grad caro-grad3').addClass('caro-grad5');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- $('.carousel-indicators li').removeClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch({isVideo: true, url:'../wp-content/themes/daw/img/camera.mp4', poster:'../wp-content/themes/daw/img/camera.jpg'});
|
|
|
- }
|
|
|
- if (consta === 5) {
|
|
|
- $('a[href="#art"]').tab('show')
|
|
|
- $( '#studio-caro' ).addClass('caro-grad5').removeClass('caro-grad2 caro-grad caro-grad3');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- $('.carousel-indicators li').removeClass('darken-carousel-indicators');
|
|
|
- $("#studio-caro").backstretch({url:'../wp-content/themes/daw/img/paints2.jpg', fade: 250 });
|
|
|
- }
|
|
|
- }, 10);
|
|
|
- });
|
|
|
-
|
|
|
- $('#caro').on('slide.bs.carousel', function() {
|
|
|
- $('.active #svg-imac.bg').attr('class', 'svg screen');
|
|
|
- $('.active .animac').addClass('fade-svg').delay(1000).queue(function(hideit){
|
|
|
- $(this).addClass('hide-svg');
|
|
|
- hideit();
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- $('#caro').on('slid.bs.carousel', function() {
|
|
|
- $('.active .animac').removeClass('hide-svg fade-svg');
|
|
|
- var animac = new DrawFillSVG({elementId: 'svg-imac'});
|
|
|
- var animac1 = new DrawFillSVG({elementId: 'sv'});
|
|
|
- var animac2 = new DrawFillSVG({elementId: 'svg-mac'});
|
|
|
- var animac3 = new DrawFillSVG({elementId: 'svg-device'});
|
|
|
- animac.replay();
|
|
|
- animac1.replay();
|
|
|
- animac2.replay();
|
|
|
- animac3.replay();
|
|
|
- });
|
|
|
+ const slides = Array.from(caro.querySelectorAll('.dw-fade-slide'));
|
|
|
+ const tabs = Array.from(document.querySelectorAll('.dw-studio-tab'));
|
|
|
+ const panes = Array.from(document.querySelectorAll('#studio-tab .tab-pane'));
|
|
|
+ const bg = stage.querySelector('.dw-studio-bg');
|
|
|
+ const video = stage.querySelector('.dw-studio-video');
|
|
|
+ const title = document.querySelector('.site-title a');
|
|
|
|
|
|
-});
|
|
|
+ const GRADS = ['caro-grad', 'caro-grad2', 'caro-grad3', 'caro-grad5'];
|
|
|
+ // per slide: gradient class · background image · show video · navbar-title light
|
|
|
+ const CONFIG = [
|
|
|
+ { grad: 'caro-grad5', img: stage.dataset.bg0 || null, video: false, light: true }, // 0 Studio
|
|
|
+ { grad: 'caro-grad', img: null, video: false, light: true }, // 1 Web
|
|
|
+ { grad: 'caro-grad2', img: null, video: false, light: true }, // 2 UX
|
|
|
+ { grad: 'caro-grad3', img: null, video: false, light: false }, // 3 Graphic
|
|
|
+ { grad: 'caro-grad5', img: null, video: true, light: true }, // 4 Media
|
|
|
+ { grad: 'caro-grad5', img: stage.dataset.bg5 || null, video: false, light: true }, // 5 Art
|
|
|
+ ];
|
|
|
+ const INTERVAL = 5000;
|
|
|
+
|
|
|
+ let index = 0;
|
|
|
+ let timer = null;
|
|
|
+
|
|
|
+ function drawSVGs(slide) {
|
|
|
+ if (!window.DrawFillSVG) return;
|
|
|
+ slide.querySelectorAll('svg[id]').forEach(function (svg) {
|
|
|
+ try {
|
|
|
+ new window.DrawFillSVG({ elementId: svg.id }).replay();
|
|
|
+ } catch (e) {
|
|
|
+ /* svg not animatable — skip */
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function activate(i) {
|
|
|
+ i = (i + slides.length) % slides.length;
|
|
|
+ index = i;
|
|
|
+ const cfg = CONFIG[i];
|
|
|
+
|
|
|
+ slides.forEach((s, n) => {
|
|
|
+ const on = n === i;
|
|
|
+ s.classList.toggle('active', on);
|
|
|
+ // reveal the active slide's content (slides 2/3/5 ship with .hide-svg)
|
|
|
+ const animac = s.querySelector('.animac');
|
|
|
+ if (animac && on) animac.classList.remove('hide-svg');
|
|
|
+ });
|
|
|
+ tabs.forEach((t, n) => t.classList.toggle('active', n === i));
|
|
|
+ panes.forEach((p, n) => p.classList.toggle('active', n === i));
|
|
|
+
|
|
|
+ GRADS.forEach((g) => stage.classList.remove(g));
|
|
|
+ stage.classList.add(cfg.grad);
|
|
|
+
|
|
|
+ if (bg) bg.style.backgroundImage = cfg.img ? 'url("' + cfg.img + '")' : '';
|
|
|
+ if (video) {
|
|
|
+ if (cfg.video) {
|
|
|
+ video.style.display = 'block';
|
|
|
+ video.play().catch(function () {});
|
|
|
+ } else {
|
|
|
+ video.pause();
|
|
|
+ video.style.display = 'none';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (title) title.classList.toggle('light', cfg.light);
|
|
|
+
|
|
|
+ drawSVGs(slides[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ function next() { activate(index + 1); }
|
|
|
+ function start() { stop(); timer = window.setInterval(next, INTERVAL); }
|
|
|
+ function stop() { if (timer) { window.clearInterval(timer); timer = null; } }
|
|
|
+
|
|
|
+ tabs.forEach(function (t) {
|
|
|
+ t.addEventListener('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ activate(parseInt(t.dataset.slide, 10) || 0);
|
|
|
+ start(); // restart the autoplay clock after manual navigation
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // pause autoplay while the pointer is over the hero
|
|
|
+ stage.addEventListener('mouseenter', stop);
|
|
|
+ stage.addEventListener('mouseleave', start);
|
|
|
+
|
|
|
+ activate(0);
|
|
|
+ start();
|
|
|
+})();
|