$(function(){
tl = TweenMax;
var bgAttr = $('.fullpage .section:first-child .bg').css('background');
var secNavName = ["HOME","Immunity","PHAGERIARUS®","Partnering"];
var footerWidth = $('footer').outerWidth();
//height 모바일 높이 대응
function resetHeight(){
var footerWidth = $('footer').outerWidth();
}
window.addEventListener("resize", resetHeight);
resetHeight();
$(".fullpage").css("background",bgAttr);
function footerShow() {
tl.staggerFromTo($("#container,#wrap #sub_logo"), 0.6, {x: '0px'}, {x: '-'+footerWidth, ease: Power1.easeInOut});
tl.staggerFromTo($("#wrap .header_wrap"), 0.6, {x: '0px'}, {x: '-'+footerWidth, ease: Power1.easeInOut});
tl.staggerFromTo($(".footer_wrap"), 0.6, {opacity:0}, {opacity: 1, delay:0.1, ease: Power1.easeInOut});
}
function footerHide() {
tl.staggerFromTo($("#container,#wrap #sub_logo"), 0.6, {x: '-'+footerWidth}, {x: '0px', ease: Power1.easeInOut});
tl.staggerFromTo($("#wrap .header_wrap"), 0.6, {x: '-'+footerWidth}, {x: '0px', ease: Power1.easeInOut});
tl.staggerFromTo($(".footer_wrap"), 0.6, {opacity:1}, {opacity: 0, ease: Power1.easeInOut});
}
var mainSlider = new Swiper('.fullpage', {
effect: 'fade',
speed: 1000,
loop:false,
autoplay:false,
fadeEffect: {
crossFade: false
},
mousewheel: true,
mousewheel: {
releaseOnEdges: true,
sensitivity:3,
},
watchSlidesVisibility: true,
watchSlidesProgress: true,
pagination: {
el: '.fullpage_wrap .pagination',
clickable: true,
renderBullet: function (index, className) {
return '
'+
'
'+
'
'+(secNavName[index])+'
'+
'
'
}
},
on: {
init: function () {
},
transitionStart: function () {
var secNum = this.activeIndex +1;
$('.sec'+secNum).addClass('ani');
$(".fullpage_pagination").addClass('none');
$('.fullpage .sec1').removeClass('first');
tl.staggerFromTo($(".fullpage_pagination .list.swiper-pagination-bullet-active .text span"), 0.6, {opacity: 0, y: '-100%',rotation:'0.001deg'}, {opacity: 1, y: '0%', ease: Power1.easeInOut}, .02);
if(!$(".section.last_slide").hasClass("swiper-slide-active")){
$("body").removeClass("end");
tl.staggerFromTo($("body #container"), 0.6, {x: '0px'}, {x: '0px', ease: Power1.easeInOut});
tl.staggerFromTo($("body #wrap .header_wrap"), 0.6, {x: '0px'}, {x: '0px', ease: Power1.easeInOut});
tl.staggerFromTo($(".footer_wrap"), 0.6, {opacity:1}, {opacity: 0, ease: Power1.easeInOut});
}
tl.staggerFromTo($("body.end #container"), 0.6, {x: '0px'}, {x: '-'+footerWidth, ease: Power1.easeInOut});
tl.staggerFromTo($("body.end #wrap .header_wrap"), 0.6, {x: '0px'}, {x: '-'+footerWidth, ease: Power1.easeInOut});
tl.staggerFromTo($("body.end .footer_wrap"), 0.6, {opacity:0}, {opacity: 1, delay:0.1, ease: Power1.easeInOut});
/*main3*/
spanWidth = 25 * secNum;
$(".fullpage_pagination .pagewrap span").css("width", spanWidth+"%");
$(".main3 .fullpage_nav>ul>li:eq("+ (secNum - 1) +")").addClass("on").siblings().removeClass("on");
},
transitionEnd: function () {
var secNum = this.activeIndex +1;
var bgAttr = $('.fullpage .sec'+secNum+' .bg').css('background');
$(".fullpage").css("background",bgAttr);
$(".fullpage_pagination").removeClass('none');
if($(".section.last_slide").hasClass("swiper-slide-active")){
$("body").addClass("end");
}
},
},
});
$('footer .back_area button').on('click', function(){
$("body").removeClass("end");
$("body").removeClass("none");
footerHide();
mainSlider.slideTo(0, 1000);
});
$(".section.last_slide").on("DOMMouseScroll mousewheel wheel", function(event,delta){
if (delta > 0) { //마우스 휠을 올렸을때
}else if (delta < 0) { //마우스 휠을 내렸을때
if($("body").hasClass("end")){
$("body").addClass("none");
footerShow();
}else{
}
}
});
$("body").on("DOMMouseScroll mousewheel wheel", function(event,delta){
if (delta > 0) { //마우스 휠을 올렸을때
if($("body").hasClass("end")){
$("body").removeClass("none");
footerHide();
}else{
}
}
});
$.each($(".fullpage_pagination .list"), function(i, v) {
var pageText = $(this).find(".text");
var animatedPage = $(this).find(".text").text().split("");
pageText.empty();
$.each(animatedPage, function(i, v) {
pageText.append(
''+
''+v+''+
''+v+''+
'
'
);
});
});
$.each($(".section .link_g .more_icon"), function(i, v) {
var pageText = $(this).find("div");
var animatedPage = $(this).find("div").text().split("");
pageText.empty();
$.each(animatedPage, function(i, v) {
pageText.append(
''+
''+v+''+
''+v+''+
'
'
);
});
});
$(".section .link_g .more_icon").mouseenter(function(){
tl.staggerFromTo($(this).find('span'), 0.4, {opacity: 1, y: '-100%',rotation:'0.001deg'}, {opacity: 1, y: '0%', ease: Power1.easeInOut}, .01);
});
//video popup
var bg = $("#bg");
$(document).on('click',' #bg, .close ', function () {
bg.fadeOut();
$('#video-popup div.inner').html('');
$('#video-popup').hide();
});
$('.video .play_btn').on('click', function(){
var dataUrl = $(this).data('url');
if(dataUrl){
bg.show();
$('#video-popup').show();
$('#video-popup').html(
''+
''+
'
'
);
$('#video-popup div.inner').html(dataUrl);
}else {
alert('준비중 입니다.');
}
});
$(window).on('resize', function() {
var windowSize = $(window).width();
if(windowSize <= 1279) {
} else {
bg.fadeOut();
$('#video-popup div.inner').html('');
$('#video-popup').hide();
}
}).resize();
});