240 lines
6.1 KiB
JavaScript
240 lines
6.1 KiB
JavaScript
$(function(){
|
|
//console.log("hi")
|
|
var $mainMnu = $(".gnb > ul > li");
|
|
|
|
var $mVisual = $("#mVisual");
|
|
var $mVisual_img = $("#mVisual").find(".mVisual_img > ul > li");
|
|
var $mVisual_txt = $("#mVisual").find(".mVisual_txt > ul > li");
|
|
|
|
var $mVisual_indicator = $(".mVisual_indicator");
|
|
var $mVisual_prev_btn = $mVisual_indicator.find(".mVisual_prev_btn");
|
|
var $mVisual_next_btn = $mVisual_indicator.find(".mVisual_next_btn");
|
|
|
|
var $indicator = $(".service_indicator > ul > li");
|
|
var $service_li = $(".service_container > div > ul > li");
|
|
|
|
var nowIdx = 0;
|
|
var oldIdx = nowIdx;
|
|
var headerIdx = 0;
|
|
var sectionTop = [];
|
|
|
|
$(".section").each(function(idx){
|
|
sectionTop[idx] = $(this).offset().top;
|
|
console.log("section", sectionTop[idx])
|
|
}); //section의 높이값 알아내기
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function nextIdx() {
|
|
if(nowIdx ==$mVisual_img.size()-1) {
|
|
nowIdx = 0;
|
|
}else {
|
|
nowIdx++;
|
|
}
|
|
}//nextIdx
|
|
|
|
function nextFnc() {
|
|
$mVisual_img.eq(nowIdx).stop().fadeIn(400);
|
|
$mVisual_img.eq(oldIdx).stop().fadeOut(400);
|
|
$mVisual_txt.eq(nowIdx).stop().fadeIn(400);
|
|
$mVisual_txt.eq(oldIdx).stop().fadeOut(400);
|
|
|
|
|
|
oldIdx = nowIdx;
|
|
}//nextFnc
|
|
|
|
function start() {
|
|
myInterval = setInterval(function(){
|
|
nextIdx();
|
|
nextFnc();
|
|
},4500)
|
|
$("#mVisual_txt li").css("display","block");
|
|
}//interval start
|
|
|
|
function restart() {
|
|
clearInterval(myInterval)
|
|
setTimeout(function(){
|
|
start();
|
|
},1)
|
|
}//clearInterval and start
|
|
|
|
|
|
//$mVisual.height($(window).height());
|
|
$(document).ready(function(){
|
|
// $("html, body").stop().animate({"scrollTop" : 0},400)
|
|
})//새로고침시 상단으로 이동
|
|
|
|
$(window).on("load resize", function(){
|
|
$mVisual.height($(window).height());
|
|
})// window load , resize fnc
|
|
|
|
$(window).on("load", function(){
|
|
$("html, body").stop().animate({"scrollTop" : 0},400)
|
|
$mainMnu.find("a").eq(nowIdx).addClass("on");
|
|
start();
|
|
$mVisual_img.hide().eq(nowIdx).show();
|
|
$mVisual_txt.hide().eq(nowIdx).show();
|
|
$indicator.eq(nowIdx).addClass("on");
|
|
|
|
|
|
|
|
$(".mVisual_indicator").on({
|
|
"mouseover" : function(){
|
|
clearInterval(myInterval);
|
|
$(".mVisual_txt").stop().css({"background-color" : "rgba(0,0,0,0.8)"})
|
|
},
|
|
"mouseleave" : function(){
|
|
$(".mVisual_txt").stop().css({"background-color" : "rgba(0,0,0,0.6)"})
|
|
start();
|
|
}
|
|
})
|
|
})// window load fnc
|
|
|
|
$mVisual_prev_btn.on("click", function(){
|
|
|
|
|
|
restart();
|
|
|
|
if(nowIdx == 0) {
|
|
nowIdx = $mVisual_img.size()-1;
|
|
}else {
|
|
nowIdx--;
|
|
}
|
|
|
|
$mVisual_img.eq(nowIdx).stop().fadeIn(400);
|
|
$mVisual_img.eq(oldIdx).stop().fadeOut(400);
|
|
|
|
$mVisual_txt.eq(nowIdx).stop().fadeIn(400);
|
|
$mVisual_txt.eq(oldIdx).stop().fadeOut(400);
|
|
|
|
oldIdx = nowIdx;
|
|
|
|
})//end of $mVisual_prev_btn click
|
|
|
|
$mVisual_next_btn.on("click", function(){
|
|
|
|
//restart();
|
|
nextIdx();
|
|
nextFnc();
|
|
|
|
})//end of $mVisual_next_btn click
|
|
|
|
|
|
|
|
|
|
$(window).on("scroll", function(){
|
|
|
|
var scrollH = $(window).scrollTop();
|
|
|
|
if(scrollH >100) {
|
|
$(".upArrow").stop().fadeIn(400)
|
|
$("header").css({"background-color" : "#1e3571"})
|
|
}else {
|
|
$(".upArrow").stop().fadeOut(400)
|
|
$("header").css({"background-color" : "rgba(000,000,000,0.3)"})
|
|
}//위로 올라가기 나타남과 없어짐
|
|
|
|
// if(scrollH >sectionTop[1]-200) {
|
|
// $("header").css({"background" : "#2381e3"}) //rgba(000,000,000,0.5)
|
|
// }else {
|
|
// $("header").css({"background" : "none"})
|
|
// }
|
|
|
|
|
|
|
|
$mVisual.css({"opacity" : 1-(scrollH/900)})
|
|
|
|
for(i=0; i<5; i++) {
|
|
if(scrollH >= sectionTop[i]-320) {
|
|
$(".gnb > ul > li").eq(i).children().addClass("on").parent().siblings().children().removeClass("on");
|
|
}
|
|
}
|
|
|
|
|
|
})// upArrow 나타내기
|
|
|
|
$(".upArrow").on("click", function(){
|
|
$("html, body").stop().animate({"scrollTop" : 0},400)
|
|
})//올라가기 위로
|
|
|
|
$(".downArrow").on("click", function(){
|
|
$("html, body").stop().animate({"scrollTop" : sectionTop[1]-70},600)
|
|
})//home에서 아래 화살표 클릭시 이동
|
|
|
|
|
|
|
|
|
|
$("header").find(".headerM").on("click", function(){
|
|
headerIdx = $(".headerM").index($(this));
|
|
$("html, body").stop().animate({"scrollTop" : sectionTop[headerIdx]-70},600)
|
|
console.log("sectionTop", headerIdx)
|
|
e.preventDefault();
|
|
});//메인메뉴 클릭시 해당 section이동
|
|
|
|
var flag = false;
|
|
|
|
$(".gnb > ul > li").on("mouseover", function(){
|
|
!flag;
|
|
headerIdx = $(".headerM").index($(this));
|
|
$(".sub_bg").stop().slideDown(200);
|
|
$(".sub").eq(headerIdx-1).stop().slideDown(100);
|
|
if($(this).hasClass("hit")) {
|
|
flag = !flag;
|
|
$(".sub").hide();
|
|
$(".sub_bg").stop().slideUp(100);
|
|
}
|
|
|
|
|
|
console.log("메뉴IDX", headerIdx)
|
|
})//메뉴 호버
|
|
|
|
$(".lang").on("click", function(){
|
|
$(this).find("ul").toggle();
|
|
})
|
|
|
|
|
|
|
|
|
|
$(".gnb > ul > li").on("mouseleave", function(){
|
|
$(".sub_bg").stop().slideUp(200);
|
|
$(".sub").hide();
|
|
|
|
console.log("메뉴IDX", headerIdx)
|
|
})//메뉴 호버
|
|
|
|
|
|
|
|
$indicator.on("click", function(){
|
|
nowIdx = $indicator.index($(this));
|
|
|
|
$(".service_container").stop().animate({"left" :-(nowIdx*1200)},400)
|
|
|
|
$indicator.eq(nowIdx).addClass("on").siblings().removeClass("on");
|
|
|
|
})//service에 indicator 클릭시 fnc
|
|
|
|
|
|
|
|
|
|
|
|
// $(".service_container li").on({
|
|
// "mouseenter" : function(){
|
|
// $(this).find(".topic").css({"color" : "#333"})
|
|
// $(this).find(".info").css({"opacity" : 1})
|
|
// },
|
|
// "mouseleave" : function(){
|
|
// $(this).find(".topic").css({"color" : "#fff"})
|
|
// $(this).find(".info").css({"opacity" : 0})
|
|
// }
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
})//핸들러1
|