// 디비밸리 서브페이지 공통 스크립트 (function(){ // 스크롤하면 상단 네비를 흰 바탕으로 const hd=document.querySelector('header'); if(hd){const on=()=>hd.classList.toggle('scrolled',scrollY>10);addEventListener('scroll',on,{passive:true});on()} // 상단 배너 네트워크 배경 const cv=document.getElementById('net'); // Support 페이지: 오른쪽에서 퍼져 나가는 신호 물결(응답 · 연결 느낌) // 모든 서브페이지(Company·제품·솔루션·지원·ESG·커뮤니티): 메인과 같은 반짝이는 별 + 유성 if(cv&&(document.body.classList.contains('prod')||document.body.classList.contains('cat-co'))){ const ctx=cv.getContext('2d');const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H,stars=[],shoots=[],bNext=1,bLeft=0,bAt=0;const dpr=Math.min(devicePixelRatio||1,2),t0=performance.now(); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0); stars=Array.from({length:Math.round(W*H/1900)},()=>({x:Math.random()*W,y:Math.random()*H,r:Math.random()*1.2+.2,s:Math.random()*6,d:.25+Math.random()*.75,v:.5+Math.random()*1.8,b:Math.random()<.04}))}; const draw=(now)=>{const time=Math.max(0,((now||t0)-t0)/1000);ctx.clearRect(0,0,W,H); for(const s of stars){const tw=Math.pow(Math.abs(Math.sin(time*s.v+s.s)),3),a=(.12+.88*tw)*s.d;ctx.fillStyle='rgba(220,232,255,'+a+')';ctx.beginPath();ctx.arc(s.x,s.y,s.b?s.r+.5:s.r,0,7);ctx.fill(); if(s.b&&tw>.55){const k=(tw-.55)/.45,L=(5+s.r*5)*k;ctx.strokeStyle='rgba(225,240,255,'+(.75*k*s.d)+')';ctx.lineWidth=.8;ctx.beginPath();ctx.moveTo(s.x-L,s.y);ctx.lineTo(s.x+L,s.y);ctx.moveTo(s.x,s.y-L);ctx.lineTo(s.x,s.y+L);ctx.stroke(); const g=ctx.createRadialGradient(s.x,s.y,0,s.x,s.y,L*.8);g.addColorStop(0,'rgba(190,225,255,'+(.35*k)+')');g.addColorStop(1,'rgba(190,225,255,0)');ctx.fillStyle=g;ctx.beginPath();ctx.arc(s.x,s.y,L*.8,0,7);ctx.fill()}} if(!still){if(!bLeft&&time>=bNext){bLeft=4+Math.floor(Math.random()*4);bAt=time}if(bLeft&&time>=bAt){shoots.push({x:Math.random()*W*.75+W*.25,y:Math.random()*H*.5,v:7+Math.random()*5,l:0});bLeft--;bAt=time+.12+Math.random()*.28;if(!bLeft)bNext=time+4+Math.random()*3}}; shoots=shoots.filter(s=>{s.l++;s.x-=s.v;s.y+=s.v*.45;const a=Math.max(0,1-s.l/60);const g=ctx.createLinearGradient(s.x,s.y,s.x+90,s.y-40);g.addColorStop(0,'rgba(255,255,255,'+a+')');g.addColorStop(1,'rgba(255,255,255,0)');ctx.strokeStyle=g;ctx.lineWidth=1.3;ctx.beginPath();ctx.moveTo(s.x,s.y);ctx.lineTo(s.x+90,s.y-40);ctx.stroke();return a>0}); if(!still)requestAnimationFrame(draw)}; init();draw();addEventListener('resize',()=>{init();if(still)draw()}); }else if(cv&&document.body.classList.contains('cat-sup')){ const ctx=cv.getContext('2d');const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H;const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0)}; const draw=(t)=>{ctx.clearRect(0,0,W,H);const s=(t||0)/1000; for(const [cx,cy,ph] of [[W*.8,H*.45,0]]){ for(let i=0;i<5;i++){const k=((s*.025+i/5+ph)%1);const r=60+k*Math.max(W,H)*.5; ctx.strokeStyle='rgba(120,180,245,'+(.38*Math.sin(Math.PI*k)).toFixed(3)+')';ctx.lineWidth=1;ctx.setLineDash([2,7]);ctx.beginPath();ctx.arc(cx,cy,r,0,7);ctx.stroke()}} ctx.setLineDash([]);if(!still)requestAnimationFrame(draw)}; init();draw(0);addEventListener('resize',()=>{init();if(still)draw(0)}); }else if(cv&&document.body.classList.contains('cat-svc')){ // Solution & Service 페이지: 원근감 있는 점 격자 위로 빛이 흐르는 데이터 흐름 const ctx=cv.getContext('2d');const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H;const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0)}; const draw=(t)=>{ctx.clearRect(0,0,W,H);const s=(t||0)/1000;const hz=H*.18,rows=16,cols=40; for(let r=0;r{init();if(still)draw(0)}); }else if(cv&&document.body.classList.contains('cat-com')){ // Community: 천천히 떠다니며 이어지는 점 (사람과 소식의 연결) const ctx=cv.getContext('2d'); const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H,ns=[];const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0); ns=Array.from({length:Math.round(W/38)},()=>({x:Math.random()*W,y:Math.random()*H,vx:(Math.random()-.5)*.12,vy:(Math.random()-.5)*.08,r:Math.random()*1.6+.8}))}; const draw=()=>{ctx.clearRect(0,0,W,H);const L=150; for(let i=0;iW+10)n.x=-10;if(n.y<-10)n.y=H+10;if(n.y>H+10)n.y=-10}} if(!still)requestAnimationFrame(draw)}; init();draw();addEventListener('resize',()=>{init();if(still)draw()}); }else if(cv&&document.body.classList.contains('cat-esg')){ // ESG: 원근감 있는 점 격자가 완만한 언덕처럼 일렁이고, 그 위로 빛 입자가 천천히 떠오름 const ctx=cv.getContext('2d');const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H,ps=[];const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0); ps=Array.from({length:Math.round(W/60)},()=>({x:Math.random()*W,y:Math.random()*H,r:Math.random()*1.8+.6,v:Math.random()*.15+.05,p:Math.random()*6.3}))}; const draw=(t)=>{ctx.clearRect(0,0,W,H);const s=(t||0)/1000;const hz=H*.22,rows=16,cols=40; for(let r=0;r{init();if(still)draw(0)}); }else if(cv&&document.body.classList.contains('prod')){ const ctx=cv.getContext('2d'); const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H;const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0)}; // [중심 높이, 진폭, 리본 폭, 위상, 밝기] const RGB='110,170,240'; const RIBBONS=[[.46,.34,.95,0,1],[.58,.26,.6,2.2,.5]]; const ROWS=34; const draw=(t)=>{ ctx.clearRect(0,0,W,H); const s=(t||0)/1000*.35; const step=Math.max(5,W/260); for(const [cy,amp,wid,ph,lum] of RIBBONS){ for(let x=-20;x<=W+20;x+=step){ const u=x/W; const mid=H*cy+Math.sin(u*4.6+s+ph)*H*amp+Math.sin(u*9.3-s*1.3+ph)*H*.05; const tw=u*3.6-s*.8+ph; // 리본이 꼬이는 각도 const cos=Math.cos(tw),sin=Math.sin(tw); for(let r=0;r{init();if(still)draw(0)}); }else if(cv){ const ctx=cv.getContext('2d'); const still=matchMedia('(prefers-reduced-motion: reduce)').matches; let W,H,pts=[];const dpr=Math.min(devicePixelRatio||1,2); const init=()=>{ W=cv.clientWidth;H=cv.clientHeight;cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0); pts=Array.from({length:Math.round(W*H/8000)},()=>({x:Math.random()*W,y:Math.random()*H,vx:(Math.random()-.5)*.22,vy:(Math.random()-.5)*.22,r:Math.random()*1.6+.4})); }; const draw=()=>{ ctx.clearRect(0,0,W,H);ctx.shadowBlur=0; const D=130; for(let i=0;i1.3?8:0;ctx.beginPath();ctx.arc(p.x,p.y,p.r,0,7);ctx.fill(); if(!still){p.x+=p.vx;p.y+=p.vy;if(p.x<0||p.x>W)p.vx*=-1;if(p.y<0||p.y>H)p.vy*=-1}} if(!still)requestAnimationFrame(draw); }; init();draw();addEventListener('resize',()=>{init();if(still)draw()}); } // 섹션 탭: 스크롤 위치에 맞춰 활성 표시 const links=[...document.querySelectorAll('.tabs a[href^="#"]')]; const secs=links.map(a=>document.querySelector(a.getAttribute('href'))).filter(Boolean); if(secs.length){ const mark=()=>{ let cur=secs[0]; for(const s of secs){if(s.getBoundingClientRect().top<200)cur=s} if(innerHeight+scrollY>=document.documentElement.scrollHeight-4)cur=secs[secs.length-1]; let on=null;links.forEach(a=>{const m=a.getAttribute('href')==='#'+cur.id;a.classList.toggle('on',m);if(m)on=a}); if(on&&on!==mark.last){mark.last=on;const w=on.parentElement;if(w.scrollWidth>w.clientWidth)w.scrollTo({left:on.offsetLeft-(w.clientWidth-on.offsetWidth)/2,behavior:'smooth'})} /* 활성 탭을 가운데로 */ }; addEventListener('scroll',mark,{passive:true});mark(); } // 인증서 / 프로그램등록증 전환 document.querySelectorAll('[data-seg]').forEach(seg=>{ const btns=[...seg.querySelectorAll('button')]; btns.forEach(b=>b.addEventListener('click',()=>{ btns.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-selected',x===b)}); btns.forEach(x=>{document.getElementById(x.dataset.target).hidden=(x!==b)}); })); }); // 크게 보기: 인증서, 제품 화면(data-zoom) const zoom=(img,label,wide)=>{ const lb=document.createElement('div');lb.className='lightbox'+(wide?' wide':'');lb.setAttribute('role','dialog'); lb.innerHTML='

';lb.querySelector('img').src=img.src;lb.querySelector('img').alt=img.alt; lb.querySelector('p').textContent=(label?label+' · ':'')+'클릭하면 닫힙니다'; const close=()=>{lb.remove();removeEventListener('keydown',esc)}; const esc=e=>{if(e.key==='Escape')close()}; lb.addEventListener('click',close);addEventListener('keydown',esc); document.body.appendChild(lb); }; document.querySelectorAll('.certs figure').forEach(f=>f.addEventListener('click',()=>{ const cap=f.querySelector('figcaption b');zoom(f.querySelector('img'),cap?cap.textContent:''); })); document.querySelectorAll('.eth-cert2').forEach(c=>c.querySelectorAll('.ec2-thumb,.ec2-btn').forEach(b=>b.addEventListener('click',()=>zoom(c.querySelector('img'),'ISO 9001 품질경영시스템 인증서')))); document.querySelectorAll('img[data-zoom]').forEach(img=>img.addEventListener('click',()=>zoom(img,img.alt,true))); // 솔루션 상세보기: data-sheets="이미지1,이미지2" → 브로슈어 페이지를 팝업으로 document.querySelectorAll('[data-sheets]').forEach(btn=>btn.addEventListener('click',()=>{ const srcs=btn.dataset.sheets.split(','); const m=document.createElement('div');m.className='sheet-modal';m.setAttribute('role','dialog');m.setAttribute('aria-modal','true'); m.innerHTML='
'; m.querySelector('b').textContent=btn.dataset.sheetTitle||''; m.querySelector('small').textContent=srcs.length>1?srcs.length+'페이지 · 스크롤해서 보세요':''; const body=m.querySelector('.sheet-body'); const tpl=btn.dataset.sheetTpl&&document.getElementById(btn.dataset.sheetTpl); if(tpl){body.appendChild(tpl.content.cloneNode(true));m.querySelector('small').textContent=''} else srcs.forEach((s,i)=>{const img=new Image();img.src=s;img.alt=(btn.dataset.sheetTitle||'')+' 상세 '+(i+1);img.loading=i?'lazy':'eager';body.appendChild(img)}); const close=()=>{m.remove();document.body.classList.remove('sheet-open');removeEventListener('keydown',esc);btn.focus()}; const esc=e=>{if(e.key==='Escape')close()}; m.querySelector('.sheet-x').addEventListener('click',close); m.addEventListener('click',e=>{if(e.target===m||e.target===body)close()}); addEventListener('keydown',esc); document.body.appendChild(m);document.body.classList.add('sheet-open');m.querySelector('.sheet-x').focus(); })); // 다른 곳에서 탭 열기: data-open="패널 id" → 해당 탭 선택 후 그 위치로 이동 document.querySelectorAll('[data-open]').forEach(el=>el.addEventListener('click',()=>{ const b=document.querySelector('[data-seg] [data-target="'+el.dataset.open+'"]'); if(!b)return;b.click();b.closest('[data-seg]').parentElement.scrollIntoView({behavior:'smooth'}); })); // 상담 문의 접수 완료 팝업 (확인 버튼 · 바깥 누르기 · Esc 로 닫기) function donePop(){ let d=document.querySelector('.inq-pop'); if(!d){d=document.createElement('div');d.className='inq-pop';d.setAttribute('role','dialog');d.setAttribute('aria-modal','true'); d.innerHTML='

상담문의 접수가 되었습니다.
담당자가 확인 후 연락드리겠습니다.

'; document.body.appendChild(d); const close=()=>{d.classList.remove('on');document.removeEventListener('keydown',esc)}; const esc=e=>{if(e.key==='Escape')close()}; d.addEventListener('click',e=>{if(e.target===d||e.target.tagName==='BUTTON')close()});d._esc=esc} d.classList.add('on');document.addEventListener('keydown',d._esc);setTimeout(()=>d.querySelector('button').focus(),50)} // 상담 문의 양식: 필수 항목 확인 후 회사 서버(send-inquiry.php)로 바로 메일 발송 → 실패 시 메일 앱으로 document.querySelectorAll('[data-inquiry]').forEach(f=>{ const msg=f.querySelector('.sv-msg'); f.addEventListener('submit',e=>{ e.preventDefault();let first=null; f.querySelectorAll('[required]').forEach(el=>{const bad=el.type==='checkbox'?!el.checked:!el.value.trim()||(el.type==='email'&&!/^\S+@\S+\.\S+$/.test(el.value));el.closest('label').classList.toggle('err',bad);if(bad&&!first)first=el}); if(first){msg.className='sv-msg full';msg.textContent=first.type==='checkbox'?'개인정보 수집 · 이용에 동의해 주세요.':'필수 항목을 모두 정확히 입력해 주세요.';first.focus();return} const v=n=>f.elements[n].value.trim(); const body=['[문의 제품] '+v('product'),'[성함] '+v('name'),'[회사명] '+v('company'),'[이메일] '+v('email'),'[연락처] '+v('phone'),'','[문의 내용]',v('message')].join('\n'); const mailApp=()=>{location.href='mailto:webmaster@dbvalley.com?subject='+encodeURIComponent('[홈페이지 상담문의] '+v('product')+' · '+v('company'))+'&body='+encodeURIComponent(body);msg.className='sv-msg full';msg.textContent='자동 발송에 실패해 메일 앱을 열었어요. 내용을 확인하고 보내기를 눌러 주세요.'}; const btn=f.querySelector('button[type=submit],button:not([type])');if(btn){btn.disabled=true} msg.className='sv-msg full';msg.textContent='보내는 중…'; // 회사 서버(send-inquiry.php)로 바로 발송, 실패하면 메일 앱으로 fetch('send-inquiry.php',{method:'POST',body:new FormData(f)}).then(r=>r.json().then(j=>({r,j}))).then(({r,j})=>{ if(r.ok&&j.ok){msg.className='sv-msg';msg.textContent='';f.reset();donePop()} else if(j&&j.error==='too_many'){msg.className='sv-msg full';msg.textContent='잠시 후 다시 시도해 주세요.'} else mailApp(); }).catch(mailApp).finally(()=>{if(btn)btn.disabled=false}); }); f.querySelectorAll('input,select,textarea').forEach(el=>el.addEventListener('input',()=>el.closest('label').classList.remove('err'))); }); // mFinity 인트로 그림: 보이면 한 번만 블록 · 방패가 차례로 나타남 document.querySelectorAll('.flowx').forEach(f=>{const io=new IntersectionObserver(es=>{if(es[0].isIntersecting){f.classList.add('in');io.disconnect()}},{threshold:.3});io.observe(f)}); // 연혁 타임라인: 스크롤에 맞춰 선을 채우고, 화면 가운데 연도를 강조 document.querySelectorAll('[data-tl]').forEach(tl=>{ const rows=[...tl.querySelectorAll('.tl-row')],fill=tl.querySelector('.tl-line'); const io=new IntersectionObserver(es=>es.forEach(e=>{if(e.isIntersecting){e.target.classList.add('in');io.unobserve(e.target)}}),{rootMargin:'0px 0px -12% 0px'}); rows.forEach(r=>io.observe(r)); let ticking=false; const upd=()=>{ticking=false;const r=tl.getBoundingClientRect(),mid=innerHeight*.45; fill.style.setProperty('--p',Math.max(0,Math.min(1,(mid-r.top)/r.height)).toFixed(3)); let on=rows[0];rows.forEach(x=>{if(x.getBoundingClientRect().top<=mid)on=x});rows.forEach(x=>x.classList.toggle('on',x===on))}; addEventListener('scroll',()=>{if(!ticking){ticking=true;requestAnimationFrame(upd)}},{passive:true});addEventListener('resize',upd);upd(); }); // 표 '전체 보기' 버튼: 같은 상자의 .more 행 펼치기 document.querySelectorAll('[data-more]').forEach(b=>{ const box=b.parentElement;b.addEventListener('click',()=>{const o=box.classList.toggle('open');b.textContent=o?'간단히 보기':'전체 기능 비교 보기'}); }); // 카드 분류 필터: data-filter="목록 id", 버튼 data-f ↔ 카드 data-cat document.querySelectorAll('[data-filter]').forEach(bar=>{ const box=document.getElementById(bar.dataset.filter),bs=[...bar.querySelectorAll('button')]; bs.forEach(b=>b.addEventListener('click',()=>{ bs.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',x===b)}); box.querySelectorAll('[data-cat]').forEach(el=>{el.hidden=!(b.dataset.f==='all'||el.dataset.cat===b.dataset.f)}); })); }); // ===== mFinity(physicalworks 스타일) 인터랙션 ===== const still2=matchMedia('(prefers-reduced-motion: reduce)').matches; const onView=(el,fn,th=.35)=>{const o=new IntersectionObserver(es=>es.forEach(e=>{if(e.isIntersecting){fn(e.target);o.unobserve(e.target)}}),{threshold:th});o.observe(el)}; // 문장 타이핑: 화면에 들어오면 한 글자씩 document.querySelectorAll('[data-type]').forEach(el=>{ if(still2)return; const parts=[...el.children].filter(c=>c.tagName!=='BR').map(c=>[c,c.textContent]); parts.forEach(([c])=>c.textContent=''); onView(el,()=>{ el.classList.add('typing');let p=0,k=0; const tick=()=>{if(p>=parts.length){el.classList.remove('typing');return} const [c,t]=parts[p];c.textContent=t.slice(0,++k);if(k>=t.length){p++;k=0}setTimeout(tick,45)}; tick(); },.6); }); // Before / After 슬라이더 document.querySelectorAll('[data-ba]').forEach(ba=>{ const r=ba.querySelector('.ba-range'); const set=v=>ba.style.setProperty('--ba',v+'%'); r.addEventListener('input',()=>set(r.value)); // 스크롤로 처음 보일 때 한 번만 좌우로 스윙 후 가운데에서 멈춤 if(!still2)onView(ba,()=>{let stop=false;const N=1,MOVE=1400,REST=0,A=14,t0=performance.now();r.addEventListener('pointerdown',()=>{stop=true},{once:true}); const ease=x=>-(Math.cos(Math.PI*x)-1)/2; (function step(t){if(stop)return;const e=t-t0,k=Math.floor(e/(MOVE+REST));if(k>=N){set(50);r.value=50;return} const lt=e-k*(MOVE+REST),p=Math.min(lt/MOVE,1),amp=A,v=50+Math.sin(ease(p)*Math.PI*2)*amp;set(v.toFixed(2));r.value=v;requestAnimationFrame(step)})(t0)},.5); }); // 쌓이는 카드: 보이면 선 그림 애니메이션 document.querySelectorAll('.stackc-card').forEach(c=>onView(c,()=>c.classList.add('in'),.4)); // 가로 캐러셀 document.querySelectorAll('[data-car-track]').forEach(tr=>{ const sec=tr.closest('section'),bar=sec.querySelector('.car-bar i'); const step=()=>tr.querySelector('.car-card').getBoundingClientRect().width+20; sec.querySelectorAll('[data-car]').forEach(b=>b.addEventListener('click',()=>tr.scrollBy({left:(b.dataset.car==='next'?1:-1)*step(),behavior:'smooth'}))); const upd=()=>{if(!bar)return;const w=tr.clientWidth/tr.scrollWidth;bar.style.width=(w*100)+'%';bar.style.transform='translateX('+(tr.scrollLeft/tr.clientWidth*100)+'%)'}; tr.addEventListener('scroll',upd,{passive:true});addEventListener('resize',upd);upd(); }); // 핵심 기능 14가지: 분류 탭 → 항목 → 이미지 | 설명. 자동으로 다음 기능(분류도 함께 넘어감), 마우스 올리면 멈춤 document.querySelectorAll('[data-fx]').forEach(fx=>{ const tabs=[...fx.querySelectorAll('.fx-tabs button')],groups=[...fx.querySelectorAll('.fx-items')],items=[...fx.querySelectorAll('.fx-items button')],panels=[...fx.querySelectorAll('.fx-panel')],bar=fx.querySelector('.fx-progress i'); let cur=0,timer=null,paused=false; const show=i=>{cur=i;const cat=panels[i].dataset.cat; tabs.forEach(t=>{const on=t.dataset.cat===cat;t.classList.toggle('on',on);t.setAttribute('aria-selected',on)}); groups.forEach(g=>g.hidden=g.dataset.cat!==cat); items.forEach(b=>b.classList.toggle('on',+b.dataset.i===i)); panels.forEach(p=>p.hidden=+p.dataset.i!==i)}; const restart=()=>{clearTimeout(timer);if(still2||paused||!bar)return;bar.classList.remove('run');void bar.offsetWidth;bar.classList.add('run');timer=setTimeout(()=>{show((cur+1)%panels.length);restart()},4500)}; tabs.forEach(t=>t.addEventListener('click',()=>{show(+fx.querySelector('.fx-items[data-cat="'+t.dataset.cat+'"] button').dataset.i);restart()})); items.forEach(b=>b.addEventListener('click',()=>{show(+b.dataset.i);restart()})); fx.addEventListener('mouseenter',()=>{paused=true;clearTimeout(timer);bar&&bar.classList.remove('run')}); fx.addEventListener('mouseleave',()=>{paused=false;restart()}); onView(fx,restart,.3); }); // 보안 6단계: 항목 선택 시 링 노드 강조, 자동 순환 document.querySelectorAll('[data-sec6]').forEach(box=>{ // 암호화 통신 → … → 분실 디바이스 대응 순서로 자동 진행, 마우스를 올리면 멈추고 떼면 이어서 진행 const items=[...box.querySelectorAll('li')],nodes=[...box.querySelectorAll('.sec6x-node')],DUR=2600;let cur=0,timer=null,seen=false; const show=i=>{cur=i;items.forEach((x,j)=>x.classList.toggle('on',j===i));nodes.forEach((x,j)=>x.classList.toggle('on',j===i))}; const play=()=>{if(still2||timer)return;box.classList.add('playing');box.style.setProperty('--dur',DUR+'ms');items[cur].classList.remove('on');void items[cur].offsetWidth;items[cur].classList.add('on');timer=setInterval(()=>show((cur+1)%items.length),DUR)}; const stop=()=>{clearInterval(timer);timer=null;box.classList.remove('playing')}; items.forEach((li,i)=>{li.addEventListener('mouseenter',()=>show(i));li.addEventListener('click',()=>{stop();show(i)})}); nodes.forEach((n,i)=>n.addEventListener('mouseenter',()=>show(i))); box.addEventListener('mouseenter',stop); box.addEventListener('mouseleave',()=>{if(seen)play()}); box.addEventListener('focusin',stop); onView(box,()=>{seen=true;if(!box.matches(':hover'))play()},.3); }); // 구축 사례 아코디언: 하나만 열고, 왼쪽 이미지 교체 document.querySelectorAll('[data-acc]').forEach(acc=>{ const ds=[...acc.querySelectorAll('details')],imgs=[...acc.querySelectorAll('.acc-media > [data-i]')]; // 모바일(한 줄 배치): 그림을 지금 펼친 항목 바로 위로 옮기고 그림이 보이게 스크롤. PC에서는 원래 자리(왼쪽) const media=acc.querySelector('.acc-media'),list=acc.querySelector('.acc-list'),mq=matchMedia('(max-width:1000px)'); const place=(scroll)=>{if(!media||!list)return;const d=ds.find(o=>o.open); if(mq.matches&&d){if(d.previousElementSibling!==media)list.insertBefore(media,d);media.classList.add('in-list'); if(scroll){const y=media.getBoundingClientRect().top+scrollY-150;scrollTo({top:y,behavior:still2?'auto':'smooth'})}} else if(media.parentNode!==acc){acc.insertBefore(media,list);media.classList.remove('in-list')}}; ds.forEach(d=>d.addEventListener('toggle',()=>{if(!d.open)return;ds.forEach(o=>{if(o!==d)o.open=false});imgs.forEach(im=>{im.hidden=im.dataset.i!==d.dataset.i});place(d.dataset.user==='1');d.dataset.user=''})); ds.forEach(d=>d.querySelector('summary').addEventListener('click',()=>{d.dataset.user='1'})); (mq.addEventListener?mq.addEventListener('change',()=>place(false)):mq.addListener(()=>place(false)));place(false); }); // 교육 · 지원 로드맵: 보이면 선과 카드가 차례로 나타남 document.querySelectorAll('[data-road]').forEach(r=>{if(still2){r.classList.add('in');return}onView(r,()=>r.classList.add('in'),.25)}); // AX 게이지: 화면에 들어오면 채워짐 document.querySelectorAll('[data-ax2]').forEach(c=>{if(still2){c.classList.add('in');return}onView(c,()=>c.classList.add('in'),.5)}); // 숫자 카운터: 화면에 들어오면 0부터 올라감 document.querySelectorAll('[data-count]').forEach(el=>{ const end=+el.dataset.count;if(still2)return;el.textContent='0'; onView(el,()=>{const t0=performance.now();(function step(t){const p=Math.min((t-t0)/1300,1);el.textContent=Math.round(end*(1-Math.pow(1-p,3)));if(p<1)requestAnimationFrame(step)})(t0)},.6); }); // 뒤집히는 카드: 터치 기기에서도 눌러서 뒤집기 document.querySelectorAll('.flip').forEach(f=>f.addEventListener('click',()=>f.classList.toggle('on'))); // 보안 스위치 켜고 끄기 document.querySelectorAll('.sw-btn').forEach(b=>b.addEventListener('click',()=>{const on=!b.classList.contains('on');b.classList.toggle('on',on);b.setAttribute('aria-checked',on)})); // 고객사 칩: 순서대로 나타나는 지연값 document.querySelectorAll('.ref-cloud li').forEach((li,i,arr)=>{const idx=[...li.parentElement.children].indexOf(li);li.style.setProperty('--d',idx*35)}); // 고객사 분야 필터 const fbtns=[...document.querySelectorAll('.filters:not([data-filter]) button')]; fbtns.forEach(b=>b.addEventListener('click',()=>{ fbtns.forEach(x=>x.classList.toggle('on',x===b)); const k=b.dataset.f; document.querySelectorAll('.logos [data-c]').forEach(el=>{el.hidden=!(k==='all'||el.dataset.c===k)}); })); // 이메일 복사 document.querySelectorAll('.copy-btn').forEach(b=>b.addEventListener('click',()=>{ const t=b.dataset.copy;const done=()=>{const o=b.textContent;b.textContent='복사됨';setTimeout(()=>b.textContent=o,1400)}; try{navigator.clipboard.writeText(t).then(done,()=>{})}catch(e){} })); })(); // Community: 더보기 + 갤러리 확대 document.querySelectorAll('[data-pager]').forEach(ul=>{ const n=+ul.dataset.pager,items=[...ul.children],btn=ul.parentElement.querySelector('[data-more-list]');let shown=n; const apply=()=>{items.forEach((li,i)=>li.classList.toggle('cm-hide',i>=shown));if(btn)btn.hidden=shown>=items.length}; apply();btn&&btn.addEventListener('click',()=>{shown+=n;apply()}); }); (()=>{const lb=document.querySelector('.cm-lb');if(!lb)return;const im=lb.querySelector('img'),cap=lb.querySelector('figcaption'); const close=()=>{lb.hidden=true;im.removeAttribute('src')}; document.querySelectorAll('[data-lb]').forEach(b=>b.addEventListener('click',()=>{im.src=b.dataset.lb;im.alt=cap.textContent=b.querySelector('span').textContent;lb.hidden=false;lb.querySelector('.x').focus()})); lb.addEventListener('click',e=>{if(e.target===lb||e.target.classList.contains('x'))close()}); addEventListener('keydown',e=>{if(e.key==='Escape'&&!lb.hidden)close()}); })(); // Premier 개요 모니터: 스크롤에 따라 살짝 옆으로 돌아감 (()=>{const el=document.querySelector('.pr-img');if(!el||matchMedia('(prefers-reduced-motion: reduce)').matches)return; let raf=0;const upd=()=>{raf=0;const r=el.getBoundingClientRect(),vh=innerHeight; const p=Math.max(-1,Math.min(1,(r.top+r.height/2-vh/2)/(vh/2)));el.style.setProperty('--ry',(-4+p*-8).toFixed(2)+'deg')}; addEventListener('scroll',()=>{if(!raf)raf=requestAnimationFrame(upd)},{passive:true});addEventListener('resize',upd);upd(); })(); /* 우측 플로팅 버튼: 콜센터 · TOP */ (function(){if(document.querySelector(".fab"))return;var f=document.createElement("div");f.className="fab"; f.innerHTML=""; document.body.appendChild(f);var t=f.querySelector(".fab-top");t.addEventListener("click",function(){scrollTo({top:0,behavior:"smooth"})}); var u=function(){t.classList.toggle("on",scrollY>400)};addEventListener("scroll",u,{passive:true});u();})(); /* Anymate 첫 화면: 2장면 자동 전환 (3.5초, 마우스 올리면 멈춤) */ (function(){document.querySelectorAll('[data-amh]').forEach(function(w){ var sc=w.querySelectorAll('.amh-scene'),bt=w.querySelectorAll('.amh-dots button'),i=0,tm; function go(n){i=n;sc.forEach(function(s,k){s.classList.toggle('on',k===n)});bt.forEach(function(b,k){b.classList.toggle('on',k===n);b.setAttribute('aria-selected',k===n);if(k===n){b.style.animation='none';b.offsetWidth;b.style.animation=''}});restart()} function restart(){clearInterval(tm);tm=setInterval(function(){if(!w.classList.contains('paused'))go((i+1)%sc.length)},3500)} bt.forEach(function(b,k){b.addEventListener('click',function(){go(k)})}); w.addEventListener('mouseenter',function(){w.classList.add('paused')});w.addEventListener('mouseleave',function(){w.classList.remove('paused')}); restart();});})(); /* 애니톡 코딩 화면: 2000px 기준 → 박스 폭에 맞춰 축소 */ (function(){var fit=function(c){c.style.setProperty('--s',(c.clientWidth/2000)||.3)}; document.querySelectorAll('.atk-crop').forEach(function(c){fit(c);if(window.ResizeObserver)new ResizeObserver(function(){fit(c)}).observe(c)});})(); // 회사소개(Overview · CI · Vision): 스크롤 등장 애니메이션 + 숫자 카운트 + HEX 복사 (()=>{const root=document.querySelector('#overview,#ci,#vision');if(!root)return; const still=matchMedia('(prefers-reduced-motion: reduce)').matches; const groups=['.sec-head','.greet > div','.greet > .photo-ceo','.sub-title','.facts .row','.biz article','.org','.org .node,.org .team','.ci-logo','.ci-text','.cic article','.vz-phil','.vz-road','.vz-venn','.chips']; const els=[];groups.forEach(sel=>{const list=[...root.querySelectorAll(sel)];list.forEach((el,i)=>{if(el.classList.contains('rv'))return;el.classList.add('rv');el.style.setProperty('--d',Math.min(i,8));els.push(el)})}); if(still){els.forEach(e=>e.classList.add('in'));return} /* 주소지가 나올 때 직원수(마지막 줄)도 함께 나오도록 묶음 */ const facts=root.querySelectorAll('.facts .row');if(facts.length>1){const L=facts[facts.length-1],P=facts[facts.length-2];L.style.setProperty('--d',P.style.getPropertyValue('--d'));L.dataset.with='1';P._with=L} const show=el=>{el.classList.add('in');io.unobserve(el);el.querySelectorAll('.cnt-up').forEach(c=>{const to=+c.dataset.to,t0=performance.now();const f=t=>{const k=Math.min(1,(t-t0)/1200);c.textContent=Math.round(to*(1-Math.pow(1-k,3)));if(k<1)requestAnimationFrame(f)};requestAnimationFrame(f)})}; const io=new IntersectionObserver(es=>es.forEach(e=>{if(e.isIntersecting){if(e.target.dataset.with&&!e.target.classList.contains('in'))return;show(e.target);if(e.target._with&&!e.target._with.classList.contains('in'))show(e.target._with);return; e.target.querySelectorAll('.cnt-up').forEach(c=>{const to=+c.dataset.to,t0=performance.now();const f=t=>{const k=Math.min(1,(t-t0)/1200);c.textContent=Math.round(to*(1-Math.pow(1-k,3)));if(k<1)requestAnimationFrame(f)};requestAnimationFrame(f)})}}),{rootMargin:'0px 0px -10% 0px',threshold:.12}); els.forEach(e=>io.observe(e)); root.querySelectorAll('.cic-copy').forEach(b=>b.addEventListener('click',()=>{navigator.clipboard&&navigator.clipboard.writeText(b.dataset.copy);const t=b.textContent;b.textContent='복사됨';setTimeout(()=>b.textContent=t,1200)})); })(); // Vision: 2002 → 2026 (빠르게) → 2102 연도 카운터 (()=>{const box=document.querySelector('.vz-count');if(!box)return; const yr=box.querySelector('[data-yr]'),lbl=box.querySelector('[data-lbl]'),bar=box.querySelector('.vz-bar i'),ms=box.querySelectorAll('.vz-bar .m'),fin=box.querySelector('.vz-fin'),wrap=box.querySelector('.vz-yr'); const pos=y=>(y-2002)/100*100; const run=(from,to,dur,ease)=>new Promise(res=>{const t0=performance.now();const f=t=>{const k=Math.min(1,(t-t0)/dur),e=ease(k),y=Math.round(from+(to-from)*e);yr.textContent=y;bar.style.width=pos(from+(to-from)*e)+'%';if(k<1)requestAnimationFrame(f);else res()};requestAnimationFrame(f)}); const out=k=>1-Math.pow(1-k,3),slow=k=>1-Math.pow(1-k,4),inout=k=>k<.5?4*k*k*k:1-Math.pow(-2*k+2,3)/2,wait=ms=>new Promise(r=>setTimeout(r,ms)); const end=()=>{yr.textContent='2102';bar.style.width='100%';lbl.textContent='100년';ms.forEach(m=>m.classList.add('on'));wrap.classList.add('big');fin.classList.add('on')}; if(matchMedia('(prefers-reduced-motion: reduce)').matches){end();return} /* 2002→2102 를 한 번에 흐르듯 (중간 2026 에서 멈추지 않음, 지나갈 때 표시만) */ const go=async()=>{ms[0].classList.add('on');lbl.textContent='설립';await wait(300); const t0=performance.now(),dur=2600;let hit=false; await new Promise(res=>{const f=t=>{const k=Math.min(1,(t-t0)/dur),y=2002+100*inout(k);yr.textContent=Math.round(y);bar.style.width=pos(y)+'%'; if(!hit&&y>=2026){hit=true;ms[1].classList.add('on');lbl.textContent='20년의 역사'} if(k<1)requestAnimationFrame(f);else res()};requestAnimationFrame(f)}); end()}; const io=new IntersectionObserver(es=>{if(es[0].isIntersecting){io.disconnect();go()}},{threshold:.5});io.observe(box); })(); /* 주요사업 궤도: 터치 기기에서는 첫 탭에 링크 박스 열기, 박스(또는 같은 사업) 다시 탭하면 이동 */ (function(){ const orbit=document.querySelector('.biz-orbit');if(!orbit)return; const touch=matchMedia('(hover: none)'); const nodes=orbit.querySelectorAll('.bo-node'); nodes.forEach(n=>n.addEventListener('click',e=>{ if(!touch.matches||n.classList.contains('open'))return; e.preventDefault(); nodes.forEach(m=>m.classList.toggle('open',m===n)); })); document.addEventListener('click',e=>{if(!e.target.closest('.bo-node'))nodes.forEach(m=>m.classList.remove('open'))}); })(); // 모바일 메뉴 열기/닫기 (()=>{const hd=document.querySelector('header'),btn=hd&&hd.querySelector('.menu-btn'),nav=hd&&hd.querySelector('nav.main');if(!btn||!nav)return; const cta=hd.querySelector('.btn.hide-m');if(cta){const a=document.createElement('a');a.className='m-cta';a.href=cta.getAttribute('href');a.textContent=cta.textContent;nav.appendChild(a)} btn.setAttribute('aria-expanded','false'); const set=o=>{hd.classList.toggle('open',o);document.body.classList.toggle('m-lock',o);btn.textContent=o?'닫기 ✕':'메뉴 ☰';btn.setAttribute('aria-expanded',o)}; btn.addEventListener('click',()=>set(!hd.classList.contains('open'))); nav.addEventListener('click',e=>{if(e.target.closest('a'))set(false)}); addEventListener('keydown',e=>{if(e.key==='Escape')set(false)}); matchMedia('(min-width:1001px)').addEventListener('change',e=>{if(e.matches)set(false)}); })(); // 탭이 화면보다 넓을 때: 넘친 쪽 가장자리를 흐리게 → 뒤에 더 있음을 표시 document.querySelectorAll('.tabs .wrap').forEach(w=>{const u=()=>{const m=w.scrollWidth>w.clientWidth+2;w.classList.toggle('fl',m&&w.scrollLeft>4);w.classList.toggle('fr',m&&w.scrollLeftw.clientWidth+2)}; chk();addEventListener('resize',chk);if(document.fonts)document.fonts.ready.then(chk);if(window.ResizeObserver)new ResizeObserver(chk).observe(w); w.addEventListener('wheel',function(e){if(!w.classList.contains('ovf')||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;w.scrollLeft+=e.deltaY;e.preventDefault()},{passive:false}); var sx=0,sl=0,down=false,moved=false; w.addEventListener('mousedown',function(e){if(!w.classList.contains('ovf'))return;down=true;moved=false;sx=e.clientX;sl=w.scrollLeft}); addEventListener('mousemove',function(e){if(!down)return;var d=e.clientX-sx;if(Math.abs(d)>4){moved=true;w.classList.add('drag')}w.scrollLeft=sl-d}); addEventListener('mouseup',function(){down=false;w.classList.remove('drag')}); w.addEventListener('click',function(e){if(moved){e.preventDefault();e.stopPropagation();moved=false}},true); var keep=function(){var a=w.querySelector('a.on,button.on,[aria-selected="true"]');if(a&&w.classList.contains('ovf')){var l=a.offsetLeft-w.offsetLeft,r=l+a.offsetWidth;if(lw.scrollLeft+w.clientWidth-16)w.scrollTo({left:r-w.clientWidth+16,behavior:'smooth'})}}; new MutationObserver(function(ms){if(ms.some(function(m){return m.target!==w}))keep()}).observe(w,{subtree:true,attributes:true,attributeFilter:['class']}); }); })(); // 모바일: 섹션 탭을 sticky 대신 fixed 로 헤더 바로 아래 고정 // (일부 안드로이드 브라우저에서 주소창이 숨겨질 때 sticky 탭만 아래로 떠 보이는 현상 방지, 2026-11-25) (function(){ var tb=document.querySelector('.tabs'),hd=document.querySelector('header');if(!tb||!hd)return; var mq=matchMedia('(max-width:860px)'),ph=document.createElement('div');ph.setAttribute('aria-hidden','true');tb.parentNode.insertBefore(ph,tb); var raf=0,upd=function(){raf=0; if(!mq.matches){if(tb.classList.contains('fix')){tb.classList.remove('fix');tb.style.top='';ph.style.height=''}return} var hb=Math.max(0,hd.getBoundingClientRect().bottom),fix=ph.getBoundingClientRect().top<=hb; if(fix!==tb.classList.contains('fix')){ph.style.height=fix?tb.offsetHeight+'px':'';tb.classList.toggle('fix',fix)} tb.style.top=fix?hb+'px':''}; var req=function(){if(!raf)raf=requestAnimationFrame(upd)}; addEventListener('scroll',req,{passive:true});addEventListener('resize',req);if(window.visualViewport)visualViewport.addEventListener('resize',req);upd(); })();