jQuery(function($) { var footerHeight; var scTop = $(window).scrollTop(); scTop = $(window).scrollTop(); var target = 107; footerHeight = $('.fCont').outerHeight(); if ($(".subBody").length > 0) { if( scTop > $(window).height() / 3 ) { $('.btn_contentTop').css({opacity:1}) } else { $('.btn_contentTop').css({opacity:0}) } $(window).scroll(function () { footerHeight = $('.fCont').outerHeight(); scTop = $(window).scrollTop(); var target = 107; // if (top > target) { // $(".locationWrap").addClass("fixed"); // } else { // $(".locationWrap").removeClass("fixed"); // } if( scTop > $(window).height() / 3 ) { $('.btn_contentTop').css({opacity:1}) } else { $('.btn_contentTop').css({opacity:0}) } if ($(document).height() - footerHeight < (scTop + $(window).height())) { $(".btn_contentTop").addClass("ab"); $(".btn_contentTop").css({bottom: footerHeight + 50}) } else { $(".btn_contentTop").removeClass("ab"); $(".btn_contentTop").css({bottom: ""}) } }) $(".btn_contentTop").click(function (e) { $("body, html").stop().animate({ scrollTop: 0 }, { duration: 200, easing: "easeInOutCubic" }); }) } var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "Other"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; }, searchString: function (data) { for (var i = 0; i < data.length; i++) { var dataString = data[i].string; this.versionSearchString = data[i].subString; if (dataString.indexOf(data[i].subString) !== -1) { return data[i].identity; } } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index === -1) { return; } var rv = dataString.indexOf("rv:"); if (this.versionSearchString === "Trident" && rv !== -1) { return parseFloat(dataString.substring(rv + 3)); } else { return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); } }, dataBrowser: [ {string: navigator.userAgent, subString: "Edge", identity: "MS Edge"}, {string: navigator.userAgent, subString: "MSIE", identity: "Explorer"}, {string: navigator.userAgent, subString: "Trident", identity: "Explorer"}, {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"}, {string: navigator.userAgent, subString: "Opera", identity: "Opera"}, {string: navigator.userAgent, subString: "OPR", identity: "Opera"}, {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"}, {string: navigator.userAgent, subString: "Safari", identity: "Safari"} ] }; BrowserDetect.init(); var bv= BrowserDetect.browser; if( bv == "Chrome"){ $("html").addClass("chrome"); } else if(bv == "MS Edge"){ $("html").addClass("ie"); } else if(bv == "Explorer"){ $("html").addClass("ie"); } else if(bv == "Firefox"){ $("html").addClass("Firefox"); } var gnb_sub_menu_height = 0; var search_open = true; menu_layout_setting(); menu_height_setting(); screen_nav_hover(); small_screen_nav_open(); small_screen_nav_toggle(); minimize_header(); scroll_top(); scroll_down(); search_popup(); $(window).load(function() { menu_height_setting(); }) function init_resize(){ menu_height_setting(); } $(window).on('resize',init_resize); // FIX HEADER ANIMATION function minimize_header() { var $window = $(window); var $header = $('#header'); var didScroll = null; var currentScroll = 0; var lastScroll = 0; var moveScroll = 10; $window.on('scroll', function() { didScroll = true; if ($window.scrollTop() > $header.height()) { $header.addClass('minimize'); } else { $header.removeClass('minimize'); } }); if(!$header.hasClass('jt_none_scrolled')){ setInterval(function() { if (didScroll) { hasScrolled(); didScroll = false; } }, 50); } function hasScrolled(){ currentScroll = $(this).scrollTop(); // Make sure they scroll more than moveScroll if(Math.abs(lastScroll - currentScroll) <= moveScroll) return; if(currentScroll > lastScroll){ // ScrollDown if(currentScroll > $(window).height() && !$('.btnAllmenu').hasClass('open')){ // TweenMax.to( $header, 0.4, { autoAlpha:0, y: -$header.outerHeight(), ease: Power3.easeOut }); } } else { // ScrollUp // TweenMax.to( $header, 0.4, { autoAlpha:1, y: 0, ease: Power3.easeOut }); } lastScroll = currentScroll; } } if ($(".subBody").length > 0) { fixLocation() $(window).scroll(function () { fixLocation() }) $(window).resize(function () { fixLocation() }) function fixLocation() { var top = $(window).scrollTop() var target = $(".location_box").offset().top - 85; if (top > target) { $(".locationWrap").addClass("fixed"); } else { $(".locationWrap").removeClass("fixed"); } } } // SMALL SCREEN NAV function small_screen_nav_open(){ var $body = $('body'), $menu_btn = $('#small_menu_btn'), $menu_close_btn = $('#small_menu_close'), $menu_overlay = $('#small_menu_overlay'), $menu_container = $('#small_menu_container'), $lang_menu_container = $('.lang_container'), $search_container = $('.search_container'), $active_menu = null, isOpen = true; // menu on/off $menu_btn.on('click',function(){ if(isOpen){ $body.addClass('open_menu'); // active menu check if($body.hasClass('single-notice')) { $active_menu = $('#small_menu > li.menu-item-promote'); } else if ($body.hasClass('single-career') || $body.hasClass('single-inquiry')) { $active_menu = $('#small_menu > li.menu-item-career'); } else { $('#small_menu > li').each(function(){ if($(this).hasClass('current-page-ancestor')){ $active_menu = $(this); } }); } if($active_menu != null) { $active_menu.addClass('open'); $('#small_depth_menu_nav').addClass('open'); TweenLite.set($('#small_depth_menu_nav'), {x: '-100%'}); TweenLite.to($('#small_depth_menu').find('.parent-' + $active_menu.attr('id')), .3, {autoAlpha: 1}); } // open TweenLite.to($menu_overlay, .3, {autoAlpha: 1,onStart: function() {$menu_overlay.css('display', 'block');}}); TweenLite.fromTo($menu_container, .3, {x: '0%'}, { x: '-100%', onStart: function() { $menu_container.css('display', 'block'); TweenLite.to([$lang_menu_container, $search_container], .3, {autoAlpha: 1, delay: .2}); }, onComplete: function() { isOpen = false; } }); TweenLite.to($menu_close_btn, .5, { x: -($menu_container.outerWidth() + $menu_close_btn.outerWidth() + 5) }); } else { menu_close_action(); } }); // close menu $('#small_menu_close, #small_menu_overlay').on('click',function(){ menu_close_action(); }); // close menu function menu_close_action(){ TweenLite.to($menu_overlay, .5, {autoAlpha: 0,onComplete: function() {$menu_overlay.css('display', 'none');}}); TweenLite.to($menu_container, .5, { x: '100%', onStart: function() { TweenLite.set([$lang_menu_container, $search_container], { autoAlpha: 0 }); // search close if(!search_open) { $('#search_popup').css('display', 'none'); // hide motion search_close_action(); } }, onComplete: function() { $menu_container.css('display', 'none'); $('#small_menu > li').removeClass('open'); $('#small_depth_menu_nav').removeClass('open'); TweenLite.set($('#small_depth_menu_nav'), {x: '0%'}); TweenLite.set($('#small_depth_menu > li'), {autoAlpha: 0}); $body.removeClass('open_menu'); isOpen = true; } }); TweenLite.to($menu_close_btn, .3, {x: 0}); } } // 2depth menu function small_screen_nav_toggle(){ // menu top level link $('#small_menu').on('click', 'li', function(e){ e.preventDefault(); var $this = $(this); var depth_class = '.parent-' + $this.attr('id'); var $depth_menu = $('#small_depth_menu').find(depth_class); if( $depth_menu.length > 0) { // 1depth $('#small_menu > li').removeClass('open'); $this.addClass('open'); // 2depth if(!$('#small_depth_menu_nav').hasClass('open')) { $('#small_depth_menu_nav').addClass('open'); TweenLite.fromTo($('#small_depth_menu_nav'), .3, { x: '0%' }, { x: '-100%', onStart: function() { TweenLite.set($('#small_depth_menu > li'), {autoAlpha: 0}); TweenLite.to($depth_menu, .3, {autoAlpha: 1}); } }); } else { TweenLite.set($('#small_depth_menu > li'), {autoAlpha: 0}); TweenLite.to($depth_menu, .3, {autoAlpha: 1}); } } else { window.location.href = $(this).find('a').attr('href'); } }); } // GNB MENU HOVER function screen_nav_hover() { if( !is_mobile() ) { $('#header').hover(function(){ TweenMax.killTweensOf($('.menu_container_bg')); TweenMax.to($('.menu_container_bg'), .3, {height: gnb_sub_menu_height, onStart: function(){ TweenMax.set($('.menu_container_bg'), {autoAlpha: 1}); $('#menu ul.sub-menu').stop().slideDown(300); }}); $('#header').addClass('open'); }, function() { TweenMax.killTweensOf($('.menu_container_bg')); TweenMax.to($('.menu_container_bg'), .3, {height: 0, onStart: function(){ $('#menu ul.sub-menu').stop().slideUp(280); }, onComplete: function(){ TweenMax.set($('.menu_container_bg'), {autoAlpha: 0}); }}); $('#header').removeClass('open'); }); } else { $('#menu > li > a').on('click', function(event) { event.preventDefault(); if( !$('#header').hasClass('open') ) { TweenMax.killTweensOf($('.menu_container_bg')); TweenMax.to($('.menu_container_bg'), .3, {height: gnb_sub_menu_height, onStart: function(){ TweenMax.set($('.menu_container_bg'), {autoAlpha: 1}); $('#menu ul.sub-menu').stop().slideDown(300); }}); $('#header').addClass('open'); } else { var thisHref = $(this).attr('href'); location.href=thisHref; } }); } //�¬ì»¤�� ×¼붾돱 // $('#menu').on('focusin', function(){ // TweenMax.killTweensOf($('.menu_container_bg')); // TweenMax.to($('.menu_container_bg'), .3, {height: gnb_sub_menu_height, onStart: function(){ // TweenMax.set($('.menu_container_bg'), {autoAlpha: 1}); // $('#menu ul.sub-menu').stop().slideDown(300); // }}); // }).on('focusout', function(){ // TweenMax.killTweensOf($('.menu_container_bg')); // TweenMax.to($('.menu_container_bg'), .3, {height: 0, onStart: function(){ // $('#menu ul.sub-menu').stop().slideUp(280); // }, onComplete: function(){ // TweenMax.set($('.menu_container_bg'), {autoAlpha: 0}); // }}); // }) } // GNB layout setting function menu_layout_setting(){ // add background markup (full menu) $('.header_inner').prepend(''); // add small menu markup $('#menu > li').each(function(){ var $this = $(this), $sub_menu = $this.find('> ul.sub-menu'), parent_id = 'parent-' + $this.attr('id'); // 1depth $('#small_menu').append($this.clone().find('> ul.sub-menu').remove().end()); // 2depth if(!!$sub_menu.length){ var $sub_menu_li = '
  • '; var $sub_menu_clone = $sub_menu.clone(); $('#small_depth_menu').append($sub_menu_li); $('.' + parent_id).append($sub_menu_clone); } }); } // GNB 2depth menu match height function menu_height_setting() { var $sub_menu = $('#menu > li > ul.sub-menu'); // clear gnb_sub_menu_height = 0; $sub_menu.height('auto'); // sub menu height matching $sub_menu.each(function(){ if($(this).height() > gnb_sub_menu_height) { gnb_sub_menu_height = $(this).height(); } }); $sub_menu.height(gnb_sub_menu_height) } // scroll top button function scroll_top(){ var $window = $(window); var $document = $(document); var $footer = $('#footer'); var $scrollBtn = $('#go_top'); $scrollBtn.on('click',function(){ $("html, body").stop().animate({ scrollTop: 0 }, 600); return false; }); $window.on('scroll', function() { if ($window.scrollTop() < $document.height() - $window.height() - $footer.outerHeight() + 37) { $scrollBtn.addClass('js_go_top_fix'); } else { $scrollBtn.removeClass('js_go_top_fix'); } if ($window.scrollTop() < $window.height()) { $scrollBtn.addClass('js_go_top_hide'); } else { $scrollBtn.removeClass('js_go_top_hide'); } }); } // scroll down button function scroll_down(){ $('.scroll_down').on('click',function(){ var target = $(this).attr('href'); var target_top = $(target).offset().top; var header_height = $('#header').height(); var space = 0; if(!$('#header').hasClass('minimize')) { if(!is_screen(1023)) { space = 15; } else if(!is_screen(768)) { space = 10; } } $('html,body').animate({ // scrollTop : target_top - header_height + space scrollTop : target_top - header_height }, 600); return false; }); } // search popup function search_popup() { var $body = $('body'); var $open_btn = $('#search_open_btn > a'); var $close_btn = $('#search_close_btn'); var $popup = $('#search_popup'); var $form = $('.search_form'); var $input = $('#search_field'); // open $open_btn.on('click', function(e){ e.preventDefault(); if(search_open) { $body.addClass('search_open'); search_open = false; new TweenLite.fromTo($popup, .5, {y: '-100%'}, {y: '0%',ease: Power4.easeOut,onStart: function() {$popup.css('display', 'block');},onComplete: function() {$input.focus();}}); new TweenLite.fromTo ($close_btn, .2, {autoAlpha: 0,}, {autoAlpha: 1,ease: Power0.easeNone,delay: .1,onStart: function(){$close_btn.css('display', 'block');}}); } else { search_close_action(); } }); // close $close_btn.on('click', function(e){ e.preventDefault(); search_close_action(); // �¬ì»¤�� ë³µì썝 $('.search_btn').focus(); }); // input $input.keydown(function(){ $form.addClass('active'); }); $input.keyup(function(){ if( $input.val() == '' ){ $form.removeClass('active'); } else { $form.addClass('active'); } }); $input.focusout(function(){ if( $input.val() == '' ){ $form.removeClass('active'); } else { $form.addClass('active'); } }); } // search close action function search_close_action() { new TweenLite.to($('#search_popup'), .4, { y: '-100%', ease: Power4.easeOut, onComplete: function() { $('#search_popup').css('display', 'none'); $('#search_close_btn').css('display', 'none'); $('#search_field').val(''); $('#search_field').blur(); $('body').removeClass('search_open'); search_open = true; } }); } // ios debugging function ios_debugging(){ var target = $('.jt_underline_btn'); if( is_mobile_ios() ){ target.on('click touchend',function(e){ window.location = this.href; }); } } var skr; launch_skrollr(); // skrollr first load init function launch_skrollr() { if( !is_mobile() ) { skr_init(); $(window).on('load',function(){ // load again when img a load if( skr != null ) { skr.refresh(); } }) } } // skrollr init function function skr_init(){ if($(window).width() <= 1023) { if( skr != null ) { skr.destroy(); } } else { skr = skrollr.init({ smoothScrolling: false, forceHeight: false }); } } // motion waypoint_css_motion(); $(window).load(function() { motion_with_class(); //smooth_scroll(); }); /*function smooth_scroll(){ if(is_mobile() || is_mac_os()) return; $("html").easeScroll(); }*/ // function smooth_scroll(){ // if(is_mobile() || is_mac_os()) return; // var $window = $(window); // var scrollTime = 1; // var scrollDistance = $window.height() / 2.5; // $window.on("mousewheel DOMMouseScroll", function(event){ // event.preventDefault(); // var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3; // var scrollTop = $window.scrollTop(); // var finalScroll = scrollTop - parseInt(delta*scrollDistance); // TweenMax.to($window, scrollTime, { // scrollTo : { y: finalScroll, autoKill:true }, // ease: Power3.easeOut, // overwrite: 5 // }); // }); // } function motion_with_class(){ // nothing on mobile if(is_mobile()) return; // Title (h2 h3 ...) $('.jt_animate_title').each(function() { var $this = $(this); var tl = new TimelineLite({paused:true}); TweenMax.set($this, {autoAlpha:0, y:50}); // avoid ie fouc tl.to($this, 1.4, motion_args({ autoAlpha:1, y:0, ease:Back.easeOut})); $this.waypoint(function() { tl.play(); this.destroy(); }, { offset: "90%" }); }); // Subtitle $('.jt_animate_subtitle').each(function() { var $this = $(this); var tl = new TimelineLite({paused:true}); TweenMax.set($this, {autoAlpha:0, y:50}); // avoid ie fouc tl.to($this, 1.2, motion_args({ autoAlpha:1, y:0, ease:Back.easeOut})); $this.waypoint(function() { tl.play(); this.destroy(); }, { offset: "90%" }); }); // Buttom $('.jt_animate_btn').each(function() { var $this = $(this); var tl = new TimelineLite({paused:true}); TweenMax.set($this, {autoAlpha:0}); // avoid ie fouc tl.to($this, 1.2, { autoAlpha:1, ease:Back.easeOut}); $this.waypoint(function() { tl.play(); this.destroy(); }, { offset: "70%" }); }); // Text $('.jt_animate_txt').each(function() { var $this = $(this); var tl = new TimelineLite({paused:true}); if($(window).width() > 1400){ var txt_original = $this.html(); // var txt_split = new SplitText($this , {type:"lines"}); // var lines = txt_split.lines; //an array of all the divs that wrap each character // Avoid ie fouc TweenMax.set($this, {autoAlpha:0, y:30}); // Animate tl.staggerTo($this, 2.2, motion_args({autoAlpha:1, y:0, ease:Back.easeOut, onComplete : function(){ $this.html(txt_original); }}), 0.1, "+=0"); }else{ // simple motion on medium screen // 9br issue, remove br from the dom not working) TweenMax.set($this, {autoAlpha:0, y:30}); tl.to($this, 2.2, motion_args({ autoAlpha:1, y:0, ease:Back.easeOut})); } $this.waypoint(function() { tl.play(); this.destroy(); }, { offset: "90%" }); }); // 3d Card $('.jt_animate_card').each(function() { var $this = $(this); var off_set = $this.attr('data-offset'); var tl = new TimelineLite({paused:true}); if(off_set == undefined){ off_set = '100%'; } if($this.hasClass('jt_animate_card_no_3d')){ tl.from($this, 1.6, {y:'50%',force3D:true, ease:Power3.easeOut}); }else{ TweenMax.set($this, {css:{transformPerspective:400, transformStyle:"preserve-3d"}}); tl.from($this, 1.6, {y:'40%', z: 40, rotationX:4,force3D:true, ease:Power3.easeOut}); } tl.from($this, 0.5, {autoAlpha:0, ease:Power3.easeOut},"-=1.6"); $this.waypoint(function() { tl.play(); this.destroy(); }, { offset: off_set }); }); } function waypoint_css_motion(){ // nothing on mobile if(is_mobile()) return; // use each loop the get the offset from the data attribut $('.jt_waypoint').each(function() { var $this = $(this); $this.waypoint(function() { $this.addClass('jt_animate'); this.destroy(); }, { offset: $this.attr("data-offset") }); }); } // Debug ie not smoothy text motion function motion_args(args){ if($('html').hasClass('ie')){ args.rotation = 0.1; } return args } jt_board_list_fullclick() // LIST FULL CLICK function jt_board_list_fullclick() { $('.jt_newsfeed_item').on('click', function(e){ e.stopPropagation(); var target = e.target; var url = $(this).find('a:first').attr('href'); if(url != undefined){ if($('body').find('.jt_newsfeed_origin').length > 0) { // �¸ë줎ë³´ë룄, IR�먮즺�� var openNewWindow = window.open("about:blank"); openNewWindow.location.href = url; return false; } else { window.location.href = url; } } }); } // sub sub_page_section(); subpage_title_motion(); function sub_resize(){ sub_page_section(); } $(window).on('resize',sub_resize); function subpage_title_motion(){ // nothing on mobile if(is_mobile()) return; var $header = $('.article_header'); var tl = new TimelineLite({delay:0.5}); if($('.article_title').length > 0 ){ // var title = new SplitText($('.article_title'), {type:"chars"}); // var title_chars = title.chars; tl.staggerFromTo($('.article_title'), 1, motion_args({force3D:true, autoAlpha:0, y:10}), motion_args({autoAlpha:1, y:0, ease:Back.easeOut, onComplete:function(){ $('.article_title').addClass('completed'); } }), 0.1, "+=0.4") } if($('.article_sub_title').length > 0 ){ // var subtitle = new SplitText($('.article_sub_title'), {type:"chars"}); // var subtitle_chars = subtitle.chars; tl.staggerFromTo($('.article_sub_title'), 2, motion_args({force3D:true, autoAlpha:0, y:-10}), motion_args({autoAlpha:1, y:0, ease:Power3.easeOut }), 0.1, "-=1.2") } if($('.article_desc').length > 0 ){ var $desc = $('.article_desc'); var desc_txt_original = $desc.html(); // var desc = new SplitText($desc, {type:"lines"}); // var desc_lines = desc.lines; tl.staggerFromTo($desc,2.5, motion_args({force3D:true,autoAlpha:0, y:10}), motion_args({autoAlpha:1, y:0, ease:Power3.easeOut, onComplete : function(){ $desc.html(desc_txt_original); } }), 0.1, "-=1.4"); } $header.imagesLoaded( { background: '.article_header_bg' }, function() { $header.addClass('bg_loaded'); }); } // sub page layout setting function sub_page_section(){ var $window = $(window), $article_header = $('.article_header'), $article_inner = $('.article_header_inner'), $article_breadcrumbs = $('.article_breadcrumbs'), $breadcrumbs = $('.breadcrumb'), over_height = 0; if( !$article_header.length ) { return; } if(!is_screen(1550)) { over_height = 206; } else if(!is_screen(1400)) { over_height = 170; } else if(!is_screen(1280)){ over_height = 130; } else { over_height = 0; } // $article_header.height($window.height()); // if(!is_screen(1280)) { // $article_inner.css('height', $window.height()); // $article_breadcrumbs.css({ // 'height': $breadcrumbs.outerHeight(), // 'margin-top': -($breadcrumbs.outerHeight()) // }); // } else { // $article_inner.css('height', $window.height()); // $article_breadcrumbs.css({ // 'height': 'auto', // 'margin-top': 0 // }); // } // $article_inner.css('height', $window.height()); // $article_breadcrumbs.css({ // 'height': $breadcrumbs.outerHeight(), // 'margin-top': -($breadcrumbs.outerHeight() - 1) // }); } /* * Displacmeent mapping * USAGE : - data-img="/images/sub/visual/ceo-visual-fg.jpg" - data-depth="/images/sub/visual/ceo-visual-depth.jpg" - data-intensity="50" */ function jt_displacement(){ // nothing on mobile if(is_mobile()) return; // Nothing if not necessary (avoid bug and perf issue) if($('.article_header_bg').length <= 0 || $('.article_header_bg').attr('data-img') == undefined || $('.article_header_bg').attr('data-depth') == undefined || $('.article_header_bg').attr('data-img') == ""|| $('.article_header_bg').attr('data-depth') == "") { return; } // Clean pixi console PIXI.utils.skipHello(); // Init the requ var win_w = window.innerWidth; var win_h = window.innerHeight; var w = 1903; var h = 1160; var scale = 1; var breacrumb_offset = 0; if(win_w > w ){ w = win_w+30; h = win_w/1.65517241379; //breacrumb_offset = Math.abs(parseInt($('.article_breadcrumbs').css('margin-top'))); //scale = $('.article_header_bg').width()/($('.article_header_bg').height() + breacrumb_offset); } //var w = 1903; //var h = 1160; //var containerSize = {x:window.innerWidth ,y:1160}; var renderer = new PIXI.WebGLRenderer(w, h,{ transparent: true }); var cOutput = $('.article_header_bg')[0]; var intensity = 20; if($('.article_header_bg').attr('data-intensity') != undefined && $('.article_header_bg').attr('data-intensity') != ""){ intensity = parseInt($('.article_header_bg').attr('data-intensity')); } // avoid overflow $('.article_header_bg').width(win_w).css('overflow','hidden'); cOutput.appendChild(renderer.view); var stage = new PIXI.Container(); var container = new PIXI.Container(); var foreground = new PIXI.Container(); stage.addChild(container); stage.addChild(foreground); var f; var d; var fg; var mousex = w/2, mousey = h/2; var ploader = new PIXI.loaders.Loader(); var img_original = $('.article_header_bg').attr('data-img'); var img_depth = $('.article_header_bg').attr('data-depth'); // Load and Run var init = function(){ ploader.add('fg', img_original); ploader.add('depth', img_depth); ploader.once('complete', displacement); // Begin loading - ploader.load(); }, // Init the magic displacement = function() { fg = new PIXI.Sprite(ploader.resources.fg.texture); //fg = background(containerSize, new PIXI.Sprite.fromImage(ploader.resources.fg.texture),'cover'); //console.log(fg.height); // Cover var sp = {x:fg.width,y:fg.height}; var winratio = win_w/win_h; var spratio = sp.x/sp.y; var scale = 1; var pos = new PIXI.Point(0,0); //console.log(winratio); //console.log(spratio); if(winratio > spratio) { //photo is wider than background //console.log('photo is wider than background'); scale = w/sp.x; pos.y = -((sp.y*scale)-h)/2 } else { //photo is taller than background //console.log('photo is taller than background'); scale = h/sp.y ; pos.x = -((sp.x*scale)-w)/2 } fg.scale = new PIXI.Point(scale,scale); fg.position = pos; foreground.addChild(fg); d = new PIXI.Sprite(ploader.resources.depth.texture); f = new PIXI.filters.DisplacementFilter(d, 0); fg.filters = [f]; $('.article_header').on("mousemove", function(e) { mousex = e.clientX; mousey = e.clientY; }); animate(); }, // Animate animate = function() { //f.scale.x = (window.innerWidth/2 - mousex) / 50; //f.scale.y = (window.innerHeight/2 - mousey) / 50; f.scale.x = ($('.article_header').width()/2 - mousex) / intensity; f.scale.y = ($('.article_header').height()/2 - mousey) / intensity; fg.addChild(d); d.renderable=false; renderer.render(stage); requestAnimationFrame(animate); }, // RWD size = function(){ $('.article_header_bg').width($(window).width()); $('.article_header_bg').empty(); // resize pixis //var new_scale = get_scale(); //fg.scale = new PIXI.Point(new_scale,new_scale); }; // Start init(); // Resize $(window).on('resize',function(){ size(); }); /* function background(bgSize, inputSprite, type, forceSize) { var sprite = inputSprite; var bgContainer = new PIXI.Container(); var mask = new PIXI.Graphics().beginFill(0x8bc5ff).drawRect(0,0, bgSize.x, bgSize.y).endFill(); bgContainer.mask = mask; bgContainer.addChild(mask); bgContainer.addChild(sprite); var sp = {x:sprite.width,y:sprite.height}; if(forceSize) sp = forceSize; var winratio = bgSize.x/bgSize.y; var spratio = sp.x/sp.y; var scale = 1; var pos = new PIXI.Point(0,0); if(type == 'cover' ? (winratio > spratio) : (winratio < spratio)) { //photo is wider than background scale = bgSize.x/sp.x; pos.y = -((sp.y*scale)-bgSize.y)/2 } else { //photo is taller than background scale = bgSize.y/sp.y; pos.x = -((sp.x*scale)-bgSize.x)/2 } sprite.scale = new PIXI.Point(scale,scale); sprite.position = pos; return bgContainer; } */ } // �µì떖ê°�ì¹� slider value_core_slider(); function value_core_slider(){ // slider var $slider = $('#value_core_slider'), fx_mode = 'none'; if( !$slider.length ){ return; } // safari browser if(is_browser_safari()) { fx_mode = 'fade'; } // svg motion variables var $line = $('#value_core_circle_line'), open_values = "0% 25%;25% 50%;50% 75%;75% 100%".split(";"), close_values = "25% 25%;50% 50%;75% 75%;100% 100%".split(";"), line_index = 0, pager_index = 0, tm_object; // line setting TweenMax.set($line, {drawSVG:'0', visibility:"visible"}); // flip setting if(!is_browser_safari()) { TweenMax.set($slider, {perspective: 1000}); TweenMax.set(".value_core_slider_img", {transformStyle: 'preserve-3d', autoAlpha: 0}); TweenMax.set(".value_core_slider_img.back", {rotationY: -180}); } // pre init $(document).on('cycle-initialized', $slider, function( event, opts ){ if($(event.target).hasClass('value_core_slider')) { // settings if(!is_browser_safari()) { TweenMax.set($('.value_core_slider_item:eq(0) .value_core_slider_img'), {autoAlpha:1}); } $('#value_core_pager > li:eq(0)').addClass('active'); $('#value_core_list > li:eq(0)').addClass('active'); change_motion(); // slider pause tm_object.pause(); $slider.cycle('pause'); // slider play (waypoint) $('#value_core_slider').waypoint(function() { tm_object.resume(); $slider.cycle('resume'); }, { offset: "80%" }); } }); // Run cycle $slider.cycle({ slides : '> div', timeout : 5000, speed : 1400, swipe : false, log : false, fx : fx_mode }); // cycle before $slider.on( 'cycle-before', function(event, opts, currEl, nextEl, fwdFlag) { // disable click during the transition $('#value_core_pager > li, #value_core_list > li').off('click', switch_slide_on_click); if( is_mobile_ios() ){ // ios touch debugging $('#value_core_pager > li, #value_core_list > li').off('click touchend', switch_slide_on_click); } if(!is_browser_safari()) { // get index var now_index = $(currEl).index(); var next_index = $(nextEl).index(); // set back image var back_src = $('.value_core_slider_item:eq('+ next_index +')').attr('data-image'); $('.value_core_slider_item:eq('+ now_index +') .value_core_slider_img.back').empty().append(''); // flag check var rotate; if(fwdFlag) { rotate = -180; TweenMax.set(".value_core_slider_img.back", {rotationY: 180}); } else { rotate = 180; TweenMax.set(".value_core_slider_img.back", {rotationY: -180}); } // action var front_item = $('.value_core_slider_item:eq('+ now_index +') .front'); var back_item = $('.value_core_slider_item:eq('+ now_index +') .back'); var tl_motion = new TimelineMax({paused:true, onComplete: function(){ TweenMax.set($('.value_core_slider_item:eq('+ next_index +') .value_core_slider_img'),{autoAlpha: 1}); TweenMax.set($('.value_core_slider_item:eq('+ now_index +') .value_core_slider_img'),{autoAlpha: 0}); TweenMax.set($('.value_core_slider_item:eq('+ now_index +') .front'),{rotationY: 0}); TweenMax.set($('.value_core_slider_item:eq('+ now_index +') .back'),{rotationY: -180}); }}); tl_motion.to(front_item, 1.4, {rotationY: rotate, ease: Back.easeOut.config(1.2)}) .to(back_item, 1.4, {rotationY: 0, ease: Back.easeOut.config(1.2)}, 0); tl_motion.play(); } }); // cycle after $slider.on( 'cycle-after', function(event, opts, currEl, nextEl, fwdFlag) { line_index = $(nextEl).index()-1; change_motion(); // reinit click event after transition $('#value_core_pager > li, #value_core_list > li').on('click', switch_slide_on_click); if( is_mobile_ios() ){ // ios touch debugging $('#value_core_pager > li, #value_core_list > li').on('click touchend', switch_slide_on_click); } }); // controler hover $('#value_core_pager > li, #value_core_list > li').hover(function(){ $('#value_core_pager > li:eq('+ $(this).index() +')').addClass('hover'); $('#value_core_list > li:eq('+ $(this).index() +')').addClass('hover'); },function() { $('#value_core_pager > li, #value_core_list > li').removeClass('hover'); }); // controler action $('#value_core_pager > li, #value_core_list > li').on('click', switch_slide_on_click); if( is_mobile_ios() ){ // ios touch debugging $('#value_core_pager > li, #value_core_list > li').on('click touchend', switch_slide_on_click); } function switch_slide_on_click(){ if($(this).hasClass('active')) { return; } var current_index = $(this).index(); if(current_index === 0) { TweenMax.set($line, {drawSVG:'0% 0%'}); } else { TweenMax.set($line, {drawSVG:close_values[current_index-1]}); } $('#value_core_pager > li').removeClass('active'); $('#value_core_pager > li:eq('+current_index+')').addClass('active'); $('#value_core_list > li').removeClass('active'); $('#value_core_list > li:eq('+current_index+')').addClass('active'); $slider.cycle('goto', current_index); } // motion function change_motion() { TweenMax.killTweensOf($line); if(line_index === 3) { pager_index = 0; } else { pager_index = line_index+1; } tm_object = TweenMax.to($line, 5, {drawSVG:open_values[line_index], ease:Power0.easeNone, onComplete: function(){ TweenMax.to($line, .9, {drawSVG:close_values[line_index], ease:Power0.easeNone, onStart: function(){ $('#value_core_pager > li').removeClass('active'); $('#value_core_pager > li:eq('+pager_index+')').addClass('active'); $('#value_core_list > li').removeClass('active'); $('#value_core_list > li:eq('+pager_index+')').addClass('active'); }, onComplete: function(){ if(line_index === 3) { TweenMax.set($line, {drawSVG:'0% 0%'}); } } }); }}); } // focus check $(window).on("blur focus", function(e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": tm_object.pause(); $slider.cycle('pause'); break; case "focus": tm_object.resume(); $slider.cycle('resume'); break; } } $(this).data("prevType", e.type); }); // Chimical list TweenMax.set('.value_business_list li',{autoAlpha:0}); $('.value_business_list').waypoint(function() { $('.value_business_list li').each(function(index) { var $this = $(this); var $img = $(this).find('figure'); var $title = $(this).find('h4'); var $txt = $(this).find('p'); var $btn = $(this).find('a'); // var mySplitText = new SplitText($txt, {type:"lines"}); // var lines = mySplitText.lines; //an array of all the divs that wrap each character var tl = new TimelineLite({delay: index * .15}); // Set style because Tween from has a fouc issue on ie TweenMax.set($img, {autoAlpha:0, y:50}); TweenMax.set($title,{autoAlpha:0, y:30}); TweenMax.set($txt, {autoAlpha:0, y:50}); TweenMax.set($btn, {autoAlpha:0, y:50}); TweenMax.set($this,{autoAlpha:1}); tl.to($img, 1.8, {autoAlpha:1, y:0, ease:Back.easeOut}) .to($title, .8, {autoAlpha:1, y:0, ease:Back.easeOut}, "-=1.2") .to($txt, 2.2, {autoAlpha:1, y:0, ease:Back.easeOut}, 0.1, "-=1") .to($btn, .8, {autoAlpha:1, y:0, ease:Back.easeOut}, "-=2"); }); this.destroy(); }, { offset: "80%" }); } }); $(function() { var docHeight = $(document).height(); var footHeight = $("#footer").height(); var windowWidth = $(window).width(); var gnbTop; function resetMoGnb() { $('.mobileGnbWrap').slideUp(); $('.btnAllmenu ').removeClass('open') $('#wrap .lyDim').remove(); } $('.btnAllmenu').on('click', function(event) { event.preventDefault(); var height = jQuery('.base-height').height(); if( $('#header ').is('.mobile') ) { resetMoGnb(); return false; } if ( $('body').is('.mo') ) { if( $(this).is('.open') ) { $(this).removeClass('open') if( jQuery(window).scrollTop() > height - (height/1.5) ) { $('.gnbWrapBg').removeClass("init2"); } else { $('.gnbWrapBg').removeClass("init"); $('.gnbWrapBg').removeClass("init2"); } $('.mobileGnbWrap').slideUp(); } else { $(this).addClass('open') $('.mobileGnbWrap').slideDown(); $('.gnbWrapBg').addClass("init"); $('.gnbWrapBg').addClass("init2"); } } else { layerPop('open','popup_allmenu'); } }); $('.popup_allmenu .btnClose').on('click', function(event) { event.preventDefault(); layerPop('close','popup_allmenu'); }); $('.dim_bg').on('click', function(event) { event.preventDefault(); layerPop('close','popup_allmenu'); }); // LayerPopup �´ê¸° var popupTarget; function layerPop(n, target, type) { if (n == "open") { if (type) { $("." + target).css("z-index", "40"); $("body").append("
    ") } else { $(".popupWrap").hide(); $(".dim_bg").show(); } $(".popupWrap." + target).show(); $("body").addClass("dim"); $("." + target).attr("tabindex", -1).focus(); } else { if (type) { $("." + target).hide(); $(".dim_bg." + target).remove(); } else { $(".popupWrap").hide(); $(".dim_bg").hide(); } $("body").removeClass("dim"); } } $(window).on({ resize: function (e) { if ($(window).width() != windowWidth) { windowWidth = $(window).width(); listenWidth(); } }, load : function(e) { listenWidth(); } },10); function listenWidth() { if(windowWidth <= 778) { mobileVer() $('body').addClass('mo') }else if(windowWidth > 777 ) { pcVer() $('body').removeClass('mo') } } function mobileVer() { if ( $('#header').is('.mobile') ) docHeight = $(document).height(); // $(".mobileGnbWrap").height(docHeight); // $('#wrap').find('.lyDim').height(docHeight); } function pcVer() { resetMoGnb(); if ( $('body').is('.dim') ) { layerPop('close','popup_allmenu'); } } var motion_button = $('.jt_btn'); if( !is_mobile() ) { motion_button.hover(function() { $(this).addClass('hover') }, function() { $(this).removeClass('hover') }); } function highlight(item) { var windowTop = jQuery(window).scrollTop(); if( !$('.subStep').hasClass('noLink') ){ var itemTop = jQuery(item).position().top; var topDifference = (windowTop - itemTop); var itemHeight = jQuery(item).height(); var bottomDifference = topDifference - itemHeight; var menuId = jQuery('.subStep li a').attr('href'); if (menuId = item) { if(topDifference > -1 && bottomDifference < 0) { jQuery(".subStep li a[href='" + item + "']").parent().addClass('on'); jQuery(".subStep li a[href!='" + item + "']").parent().removeClass('on'); } // else { // jQuery(".subStep li a[href='" + item + "']").parent().removeClass('on'); // } } } if ( windowTop >= 500 ) { $('.subStep').addClass('fix') } else { $('.subStep').removeClass('fix') } } $(window).scroll(function(event) { jQuery('.subStep li a').each(function(){ var eachAttr = jQuery(this).attr('href'); highlight(eachAttr); }); }); $(document).on('click', '.subStep li a', function(event) { if( !$('.subStep').hasClass('noLink') ){ event.preventDefault(); var eachAttr = jQuery(this).attr('href'); var itemTop = jQuery(eachAttr).offset().top var body = $("html, body"); body.stop().animate({scrollTop:itemTop - 135}, 500, function() { }); } }); jQuery.fn.center = function(parent) { if (parent) { parent = this.parent(); } else { parent = window; } this.css({ "position": "absolute", "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"), "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px") }); return this; } var certificateListsBigImg; var certificateListsImgAlt; $('.certificateLists').find('a').attr('title', '�뺣�보기'); $('.certificateLists').find('a').on('click', function(event) { event.preventDefault(); certificateListsBigImg = $(this).attr('data-target'); certificateListsImgAlt = $(this).find('.txWrap .text').text() $('.certificateLists').find('a').removeClass('click'); $(this).addClass('click'); $('.certificateLyWrap').show() $('.certificateLyWrap .lyText').text(certificateListsImgAlt) $(".certificateLyWrap .certificateLyArea .imgArea img").attr('src', certificateListsBigImg).load(function() { $(".certificateLyWrap .certificateLyArea").center(false); $('.certificateLyWrap .imgArea').focus() }); }); $('.certificateLyWrap .lyClose').find('a').on('click', function(event) { event.preventDefault(); $('.certificateLyWrap').hide(); $('.certificateLists').find('a.click').focus(); $('.certificateLyWrap .lyText').text('') }); $('.certificateLyWrap .imgArea ').find('img').on('click', function(event) { event.preventDefault(); $('.certificateLyWrap').hide(); $('.certificateLists').find('a.click').focus(); $('.certificateLyWrap .lyText').text('') }); $('.certificateLyWrap .lyClose').find('a').on('keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $('.certificateLyWrap').hide(); $('.certificateLists').find('a.click').focus(); } }); $('.certificateLyWrap .imgArea').find('img').on('keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $('.certificateLyWrap').hide(); $('.certificateLists').find('a.click').focus(); } }); }); // SIMPLE MOBILE CHECK function is_mobile(){ return (/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera); } function is_mobile_ios(){ return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); } // SIMPLE BROWSER CHECK function is_browser_chrome(){ return /Chrome/.test(navigator.userAgent); } function is_browser_safari(){ return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); } function is_browser_firefox(){ return /Firefox/.test(navigator.userAgent); } function is_browser_ie(){ return ((navigator.appName == 'Microsoft Internet Explorer') || ((navigator.appName == 'Netscape') && (new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) !== null))); } function is_browser_ie9(){ return ($.browser.msie && parseInt($.browser.version, 10) <= 9) ? true : false; } // SIMPLE OS CHECK function is_mac_os(){ return navigator.platform.indexOf('Mac') > -1; } // SIMPLE SCREEN CHECK function is_screen(max_width){ if(!!window.matchMedia){ return window.matchMedia('(max-width:'+ max_width +'px)').matches; } } function sub_page_link_setting (dep1, dep2) { var gnb = $('#header #menu') gnb.find("> li." + dep1).addClass('dep1-active'); gnb.find("> li.dep1-active .sub-menu > li." + dep2).addClass('dep2-active'); var dep1_href = gnb.find('.dep1-active > a').attr('href'); var dep1_text = gnb.find('.dep1-active > a').text(); var dep2_href = gnb.find(".dep1-active .dep2-active > a").attr('href'); var dep2_text = gnb.find(".dep1-active .dep2-active > a").text(); var dep2_next_href = gnb.find(".dep1-active .dep2-active").next().find('>a').attr('href'); var dep2_prev_href = gnb.find(".dep1-active .dep2-active").prev().find('>a').attr('href'); var dep1_index = gnb.find('.dep1-active').index() + 1; var dep2_index = gnb.find(".dep1-active .dep2-active").index() + 1; var dep2_length = gnb.find(".dep1-active .sub-menu li").length; if( dep2_index <= 1 ) { if ( dep2_length === 1 ) { $('.article_header_inner .article_nav_pre').hide(); $('.article_header_inner .article_nav_next').hide(); } else { $('.article_header_inner .article_nav_pre').hide(); $('.article_header_inner .article_nav_next').attr('href', dep2_next_href); } } else if (dep2_index === dep2_length) { $('.article_header_inner .article_nav_next').hide(); $('.article_header_inner .article_nav_pre').attr('href', dep2_prev_href); } else { $('.article_header_inner .article_nav_next').attr('href', dep2_next_href); $('.article_header_inner .article_nav_pre').attr('href', dep2_prev_href); } var breadcrumb = '
  • Home
  • ' + dep1_text + '
  • ' + dep2_text + '
  • '; $('#breadcrumb').html(breadcrumb) } function gnb(dep1, dep2, dep3, dep4) { var $gnbWrap = $('.gnbWrap'), $gnbWrapBg = $('.gnbWrapBg'), $gnb = $('#gnb'), $gnbLi = $gnb.find(' > li'), $gnb2Dep = $gnbLi.find('.dep2Wrap'), $gnb2DepLi = $gnb2Dep.find('.sub-menu > ul > li'), $gnb3DepLi = $gnb2DepLi.find('.dep3 > li'), $gnb4DepLi = $gnb3DepLi.find('.dep4 > li'), resetTime = null; if( dep1) { dep1 = $(".menu_container #menu > li." + dep1).index() + 1; $('.mobileGnbWrap .allmenu > li').eq(dep1 - 1).addClass('on') } if (dep2) { dep2 = $(".menu_container #menu > li .sub-menu > li." + dep2).index() + 1; $('.mobileGnbWrap .allmenu >li').eq(dep1 - 1).find('.sub-menu > li').eq(dep2 - 1).addClass('on') } if (dep3) { dep3 = $(".menu_container #menu > li .sub-menu > li > .dep3 > li." + dep3).index() + 1; $('.mobileGnbWrap .allmenu >li').eq(dep1 - 1).find('.sub-menu > li').eq(dep2 - 1).find('.dep3 > li').eq(dep3 - 1).addClass('on') } var $allmenu = $('.menu_container #menu'), $allmenuLi = $allmenu.find(' > li'), $allmenu2Dep = $allmenuLi.find('.sub-menu'), $allmenu2DepLi = $allmenu2Dep.find(' > li'), $allmenu3DepLi = $allmenu2DepLi.find('.dep3 > li'), $allmenu4DepLi = $allmenu3DepLi.find('.dep4 > li'); $(".locationWrap .locationLink.dep1 > a").text($allmenuLi.eq(dep1 - 1).find(">a").text()); $(".locationWrap .locationLink.dep1 .selectMenu li").eq(dep1 - 1).addClass("on"); $(".locationWrap .locationLink.dep2 > a").text($allmenuLi.eq(dep1 - 1).find(">a").text()); $(".locationWrap .locationLink.dep2 .selectMenu li").eq(dep1 - 1).addClass("on"); $allmenuLi.eq(dep1 - 1).addClass("on"); $allmenuLi.eq(dep1 - 1).find($allmenu2DepLi).eq(dep2 - 1).addClass("on"); $allmenuLi.eq(dep1 - 1).find($allmenu2DepLi).eq(dep2 - 1).find($allmenu3DepLi).eq(dep3 - 1).addClass("on"); $allmenuLi.eq(dep1 - 1).find($allmenu2DepLi).eq(dep2 - 1).find($allmenu3DepLi).eq(dep3 - 1).find($allmenu4DepLi).eq(dep4 - 1).addClass("on"); var dep1Item = $allmenuLi.eq(dep1 - 1).find(".sub-menu").clone(); // $('#sideMenu').append(''); // if (dep2) { var dep2Item = $allmenuLi.eq(dep1 - 1).find(".sub-menu").clone(); dep2Item.find(".dep3").remove(); $(".locationWrap .location").append('
  • ') } $(".locationWrap .locationLink li").removeClass("on sub") $(".locationWrap .location > li:last-child").addClass("on") $(".locationWrap .locationLink .active").on('mouseenter', function(e) { e.preventDefault(); if( $(this).hasClass('on') ) { $(".locationWrap .locationLink .active").removeClass('on') } else { $(".locationWrap .locationLink .active").removeClass('on') $(this).addClass('on'); } if (!$(this).closest(".locationWrap .locationLink").find(".selectMenu").hasClass("open")) { $(".locationWrap .locationLink").find(".selectMenu").removeClass("open"); $(this).closest(".locationWrap .locationLink").find(".selectMenu").addClass("open"); } else { $(".locationWrap .locationLink").find(".selectMenu").removeClass("open"); } }) $(".locationWrap .locationLink").on('mouseleave', function(e) { e.preventDefault(); if( $(this).hasClass('on') ) { $(".locationWrap .locationLink .active").removeClass('on') } else { $(".locationWrap .locationLink .active").removeClass('on') $(this).addClass('on'); } if (!$(this).closest(".locationWrap .locationLink").find(".selectMenu").hasClass("open")) { $(".locationWrap .locationLink").find(".selectMenu").removeClass("open"); $(this).closest(".locationWrap .locationLink").find(".selectMenu").addClass("open"); } else { $(".locationWrap .locationLink").find(".selectMenu").removeClass("open"); } }) $('.gnbArea .gnb > li > a').on('click', function(event) { event.preventDefault(); }); //ê²��됰찓�� $(".btnSearchOpen").click(function (e) { e.preventDefault(); if (!$(this).hasClass("open")) { $(this).addClass("open"); $(".totalSearchWrap").slideDown({ duration: 300, easing: "easeInOutCubic" }) } else { $(this).removeClass("open"); $(".totalSearchWrap").slideUp({ duration: 300, easing: "easeInOutCubic" }) } }) $(".btnSearchClose").click(function (e) { e.preventDefault(); $(".btnSearchOpen").removeClass("open"); $(".totalSearchWrap").slideUp({ duration: 300, easing: "easeInOutCubic" }) }) //sideNav var sideNav = $("#sideNav").find('.navList'); // default reset function resetSideNav(){ sideNav.find('>li').each(function(){ var $self = $(this); sideNav.find("li").removeClass('on'); }) }; // 1depth control sideNav.find("> li > a") .bind("mouseenter", function(){ resetSideNav(); sideNav.find("> li").removeClass('on'); $(this).parent('li').addClass('on'); }) .bind("focusin", function(){ $(this).mouseenter(); }); // 1depth control sideNav.find("> li > ul a") .bind("mouseenter", function(){ sideNav.find("> li").removeClass('on'); sideNav.find("> li > ul li").removeClass('on'); $(this).parent('li').addClass('on'); $(this).parent('li').parents('li').addClass('on'); }) .bind("focusin", function(){ $(this).mouseenter(); }); //sideNav reset $('#sideNav').bind("mouseleave", function(){ resetSideNav() navInit(dep1, dep2, dep3, dep4); }); //init function navInit(dep1, dep2, dep3 , dep4){ if (dep2 != 0){ //sideNav var sideNav_dep1 = sideNav.find('> li').eq(dep2-1); sideNav_dep1.addClass('on'); if (dep3 != 0){ //sideNav var sideNav_dep2 = sideNav_dep1.find('ul li').eq(dep3-1); sideNav_dep1.find('ul').show(); sideNav_dep2.addClass('on'); if (dep4 != 0){ //sideNav var sideNav_dep3 = sideNav_dep2.find('ul li').eq(dep4-1); sideNav_dep2.find('ul').show(); sideNav_dep3.addClass('on'); } } } } try { navInit(dep1, dep2, dep3, dep4); } catch(err){ } }