File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/**
* 공통 UI 및 메뉴 로직 제어
*/
$(function () {
// 0. 메뉴 링크 자동 매핑 실행 (하위 첫 번째 메뉴 연결)
updateMenuLinks();
// 1. 페이지 타이틀에 따른 컨테이너 레이아웃 클래스 제어
const pageTitle = $(".sub_title").text().trim().toUpperCase();
const $container = $("#container");
if (pageTitle === "COMPANY") {
$container.addClass("company");
} else if (pageTitle === "PIPELINE") {
$container.addClass("pipeline");
} else if (pageTitle === "PLATFORM TECHNOLOGIES") {
$container.addClass("platform_tech");
} else {
$container.addClass("achievement");
}
// 2. 상대 경로 이미지 주소 치환 (../ -> /publish/usr/)
$('[src]').each(function () {
const src = $(this).attr('src');
if (src && src.indexOf('../') === 0) {
$(this).attr('src', src.replace(/^\.\.\//, '/publish/usr/'));
}
});
/**
* ==========================================
* 연혁(History) 스크롤 인터랙션
* ==========================================
*/
const BREAKPOINT = 1280;
function bindHistoryScroll() {
// 기존 이벤트 해제 (리사이즈 시 중복 방지)
$('.history_month').off('scroll.history');
$(window).off('scroll.history');
// 모바일/태블릿 구간에서는 실행 안 함
if ($(window).width() < BREAKPOINT) return;
/**
* 1) 연혁 영역 내부 스크롤 시 연도(Year) 활성화
*/
$('.history_month').on('scroll.history', function () {
let currentId = null;
$('.month_ul').each(function () {
// 상단 위치를 계산하여 현재 활성화된 영역 감지
if ($(this).position().top <= 1) {
currentId = this.id;
}
});
if (currentId) {
$('.year_item, .month_ul').removeClass('active');
$('#' + currentId).addClass('active'); // 월 리스트 활성화
$('#' + currentId.replace('year_', 'year')).addClass('active'); // 연도 버튼 활성화
}
});
/**
* 2) 윈도우 스크롤 시 연혁 영역 활성화 제어 (스티키 효과 등)
*/
const TARGET = 719; // 활성화 기준 좌표
const RANGE = 20; // 감지 허용 오차 범위
const $history = $('.history_month');
$(window).on('scroll.history', function () {
const scrollTop = $(this).scrollTop();
// 특정 스크롤 위치에 도달했을 때 클래스 부여
if (scrollTop >= TARGET - RANGE && scrollTop <= TARGET + RANGE) {
$history.addClass('active');
} else {
$history.removeClass('active');
}
});
}
// 연혁 스크롤 이벤트 초기화
bindHistoryScroll();
// 브라우저 리사이즈 시 대응
$(window).on('resize', function() {
bindHistoryScroll();
});
});
/**
* 하위 메뉴 구조를 분석하여 상위 메뉴의 href 링크를 자동으로 설정
*/
function updateMenuLinks() {
// 1. 2Depth 메뉴 링크 업데이트
$('.depth02').each(function () {
const $this = $(this);
const menuText = $.trim($this.text());
// Selective Autophagy: 하위 메뉴가 아닌 고정 경로로 이동
if (menuText === "Selective Autophagy") {
$this.attr('href', '/web/content.do?proFn=999314000');
return true; // continue
}
// 하위 3Depth 중 첫 번째 유효한 링크 탐색
const firstDepth03Href = $this.closest('li').find('.depth03').filter(function () {
const href = $(this).attr('href');
return href && href !== '#' && href !== '';
}).first().attr('href');
if (firstDepth03Href) {
$this.attr('href', firstDepth03Href);
}
});
// 2. 1Depth 메뉴 링크 업데이트
$('.depth01').each(function () {
// 하위에 업데이트된 2Depth 또는 존재하는 3Depth 중 첫 번째 유효한 링크 탐색
const firstChildHref = $(this).closest('li').find('.depth02, .depth03').filter(function () {
const href = $(this).attr('href');
return href && href !== '#' && href !== '';
}).first().attr('href');
if (firstChildHref) {
$(this).attr('href', firstChildHref);
}
});
}