/* *******************************************************
* filename : main.js
* description : 메인?만 ?용?는 JS
* date : 2017-05-30
******************************************************** */
jQuery(function($){
/* *********************** 메인 비주?? ************************ */
// ?의?? ?역?? 만들?? ?크롤바 ?기 측정
function getScrollBarWidth(){
if($(document).height() > $(window).height()){
$('body').append('
');
fakeScrollBar = $('#fakescrollbar');
fakeScrollBar.append('
');
var w1 = fakeScrollBar.find('div').innerWidth();
fakeScrollBar.css('overflow-y', 'scroll');
var w2 = $('#fakescrollbar').find('div').html('html is required to init new width.').innerWidth();
fakeScrollBar.remove();
return (w1-w2);
}
return 0;
}
// 메인 비주?? ?이? ?정
$("#mainVisual.full-height").each(function () {
scrollWidth = getScrollBarWidth();
var win_width = $(window).outerWidth() + getScrollBarWidth();
if ( $("#header").is(".fixed-header") ) {
var visual_height = $(window).height() // - $("#header").height(); /* header? fixed? ?닌경우?? 주석?제*/
}else {
var visual_height = $(window).height() - $("#header").height();
}
if ( win_width > 1200 ) {
$("#mainVisual").height(visual_height);
}else {
$("#mainVisual").css("height","auto");
}
$(window).resize(function () {
var win_width = $(window).outerWidth() + getScrollBarWidth();
if ( $("#header").is(".fixed-header") ) {
var visual_height = $(window).height() // - $("#header").height(); /* header? fixed? ?닌경우?? 주석?제*/
}else {
var visual_height = $(window).height() - $("#header").height();
}
if ( win_width > 1200 ) {
$("#mainVisual").height(visual_height);
}else {
$("#mainVisual").css("height","auto");
}
});
});
// 메인 비주?? zoom-out ?과
$(".main-visual-con").on('init', function(event, slick) {
$(".main-visual-item").eq(0).addClass("active-item");
});
$(".main-visual-con").on('afterChange', function(event, slick, currentSlide){
$(".main-visual-item").removeClass("active-item");
$(this).find(".main-visual-item").eq(currentSlide).addClass("active-item")
});
// 메인 비주?? ?라?드
$('.main-visual-con').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
dots:true,
autoplay: true,
speed:2000,
infinite:true,
autoplaySpeed: 4000,
easing: 'easeInOutQuint',
pauseOnHover:false
});
// ?크? ?이? 모션
var $moveIcon = $('.main-scroll-icon');
var moveIcon = setInterval(function() {
$moveIcon.animate({opacity:'.5',"margin-bottom":'-=10px'}).animate({opacity:'1',"margin-bottom":'+=10px'})
}, 1000);
/* *********************** 메인 갤러? ?라?드 ************************ */
$('.business-slide-con').slick({
slidesToShow: 1,
slidesToScroll: 1,
centerMode: true,
centerPadding: '0',
asNavFor: '.business-txt-slide-con',
prevArrow: '',
nextArrow: '',
responsive:
[
{
breakpoint: 801,
settings: {
fade: true
}
}
]
});
$('.business-txt-slide-con').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
speed:800,
asNavFor: '.business-slide-con',
responsive:
[
{
breakpoint: 801,
settings: {
}
}
]
});
/* *********************** 메인 갤러? + ?명 ?라?드 ************************ */
$('.main-slide-photo-con').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
fade: false,
dots:false,
autoplay: true,
speed:800,
infinite:true,
autoplaySpeed: 3000,
easing: 'easeInOutQuint',
pauseOnHover:false,
prevArrow: '',
nextArrow: '',
asNavFor: '.main-slide-text-con'
});
$('.main-slide-text-con').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
dots:false,
autoplay: true,
speed:800,
infinite:true,
autoplaySpeed: 3000,
easing: 'easeInOutQuint',
pauseOnHover:false,
asNavFor: '.main-slide-photo-con'
});
/* *********************** ?이?바 FIXED ************************ */
/*
$(window).scroll(function () {
var scrollHeight = $(window).scrollTop();
var rightStartTop = $(window).height() / 2;
if ( scrollHeight > rightStartTop ) {
$("#rightBar").addClass("fixed");
}else {
$("#rightBar").removeClass("fixed");
}
});
*/
/* 메인컨텐?01 :: 배너 ??? ?과*/
$(window).scroll(function(){
var window_height = $(document).scrollTop(); //?시간으? ?크롤의 ?이? 측정
var visual_height = $("#mainVisual").height() / 2;
if(window_height > visual_height){
$("#mainContent1").addClass("active");
}
});
});