$(document).ready(function () {
$('.animate').scrolla({
mobile: false,
once: true // only once animation play on scroll
});
$('.js-parallax').parallax("50%", 0.1);
$('.wiz-nice-select').niceSelect();
$(window).resize(function() {
var windowHeight = $(window).height();
var ninetypercent = .6 * windowHeight;
$(document).scroll(function() {
var y = $(this).scrollTop();
if (y > ninetypercent) {
$('.header').addClass('sticky');
} else {
$('.header').removeClass('sticky');
}
});
}).resize();
/* 유튜브 */
// Function to reveal lightbox and adding YouTube autoplay
function revealVideo(div, video_id) {
var video = document.getElementById(video_id).src;
document.getElementById(video_id).src = video + '&autoplay=1'; // adding autoplay to the URL
document.getElementById(div).style.display = 'block';
}
// Hiding the lightbox and removing YouTube autoplay
function hideVideo(div, video_id) {
var video = document.getElementById(video_id).src;
var cleaned = video.replace('&autoplay=1', ''); // removing autoplay form url
document.getElementById(video_id).src = cleaned;
document.getElementById(div).style.display = 'none';
}
var depthActive = function () {
var topCount = $(".gnb > .depth01 > li").length
, subCount = 0;
topName = []
, subName = []
, topURL = []
, subURL = []
, topHTML = ""
, subHTML = "";
$(".gnb > .depth01 > li").each(function (i) {
topName[i] = $(this).children('a').text();
topURL[i] = $(this).children('a').attr('href');
i++;
});
topHTML += '
';
$("#nav__center .depth1").append(topHTML);
if (topDepth !== -1 && subDepth !== -1) {
subCount = $(".gnb > .depth01 > li:eq(" + topDepth + ")").find('ul').children().length;
$(".gnb > .depth01 > li:eq(" + topDepth + ")").find('ul').children().each(function (i) {
subName[i] = $(this).find('a').text();
subURL[i] = $(this).find('a').attr('href');
i++;
});
subHTML += '';
$("#nav__center .depth2").append(subHTML);
$("#nav__center .depth1 > a").text($(".gnb > .depth01 > li:eq(" + topDepth + ")").find('a:first').text());
$("#nav__center .depth2 > a").text($(".gnb > .depth01 > li:eq(" + topDepth + ")").find('ul').children().eq(subDepth).find('a').text());
/* 雅뚯눘苑� 筌욑옙占쎈챷�� 筌롫뗀�� 占쎌꼷�좑쭪占� 占쎈챷�뉛옙占�
$("#navbar > .navbar-nav > li:eq(" + topDepth + ")").addClass('on open');
$("#navbar > .navbar-nav > li:eq(" + topDepth + ")").find('ul').children().eq(subDepth).addClass('on');
*/
}
};
depthActive();
// NAV TOGGLE ONCLICK WITH SLIDE
$(".clickSlide ul").hide();
$(".clickSlide").click(function () {
$(this).children(".depth_full ul").stop(true, true).slideToggle("fast"), // $(this).children('.sub_three_nav ul').stop(true, true).delay(100).slideDown("400");
$(this).toggleClass("dropdown-active");
});
$(".clickSlide").mouseleave(function () {
$(this).children('.depth_full ul').stop(true, true).delay(100).slideUp("400");
$(this).removeClass("dropdown-active");
});
});
// $(document).ready(function () {
// $(".clickSlide ul").hide();
// $(".clickSlide").click(function () {
// $(this).children(".depth_full ul").stop(true, true).show(),
// $(this).toggleClass("dropdown-active");
// });
// $(".clickSlide").mouseleave(function () {
// $(this).children('.depth_full ul').stop(true, true).hide();
// $(this).removeClass("dropdown-active");
// });
// });
// var $header_wrap = $("#header_wrap"),
// $gnb = $("#gnb");
// $gnb.children("li").each(function (index, s_full) {
// $(s_full).on("mouseover", function () {
// $header_wrap.addClass("full_down");
// });
// });
// $header_wrap.on("mouseleave", function () {
// $header_wrap.removeClass("full_down");
// });
/* 백그라운드 컬러 */
$(".data-background").css('background', function () {
return $(this).data('bg')
});
/* 폰트 컬러 */
$(".data-font-color").css('color', function () {
return $(this).data('color')
});
/* 폰트 사이즈 */
$(".data-font-size").css('font-size', function () {
return $(this).data('font-size')
});
$(".data-opacity").css('opacity', function () {
return $(this).data('opacity')
});
jQuery(document).ready(function (e) {
background();
overlay();
});
/* 백그라운드 이미지 */
function background() {
//var img=$('.image'); /* 클라스를 줄때 */
$(".data-image").css('background-image', function () {
var bg = ('url(' + $(this).data('background') + ')');
return bg;
});
}
/* 백그라운드 오버레이 */
function overlay() {
//var img=$('.image'); /* 클라스를 줄때 */
$(".data-overlay").css('background-color', function () {
var bg = ('rgba(' + $(this).data('overlay') + ')');
return bg;
});
}
/* 게시판 카테고리 셀렉트박스 */
var $mNavSelect = $("");
$("#bo_cate").append($mNavSelect);
$("#bo_cate a").each(function() {
var $anchor = $(this);
var $option = $("");
if($anchor.hasClass("bo_cate_on")){
$option.prop("selected", true);
}
$option.val($anchor.attr("href"));
$option.text($anchor.text());
$mNavSelect.append($option);
});
$mNavSelect.change(function() {
window.location = $mNavSelect.val();
});