/********************************************************************************************************* ## Sub Script ## * º» ½ºÅ©¸³Æ®ÀÇ ÀúÀÛ±ÇÀº (ÁÖ)À¥½º¸®ÆÛºí¸¯¿¡ ÀÖ½À´Ï´Ù. * º» ½ºÅ©¸³Æ®¸¦ ¹«´ÜÀ¸·Î ÀÌ¿ë(¶Ç´Â µµ¿ë)Çϰųª º¹Á¦ ¶Ç´Â ¼öÁ¤ »ç¿ë½Ã ÀúÀ۱ǹý¿¡ ÀǰŠó¹ú¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù. * ±¸¸Å ÈÄ¿¡µµ Á¦ 2Â÷ »çÀÌÆ® µî ¶óÀ̼±½º°¡ Àû¿ëµÇÁö ¾Ê´Â »çÀÌÆ®¿¡ ´ëÇÏ¿© »ç¿ëÀº ±ÝÁöµÇ¾î ÀÖ½À´Ï´Ù. * À§ »çÇ׿¡ ´ëÇÏ¿© À§¹Ý½Ã Àý´ë ÇÕÀÇ´Â ¾ø½À´Ï´Ù ! * date : 2017-03-15 * author : Joo Pil Gue (joofeel00@naver.com) *********************************************************************************************************/ $(function() { // Synchronize lnb height function syncNav() { var wSize = $(window).width(); if(wSize > 1024) { var bh = $("#container").height(); $("#header").css('height', bh + 'px'); } else { $("#header").removeAttr('style'); } } // Active Sub navigation function activeSub() { var mnuIndex = $("#container").data('menu'); var subIndex = $("#container").data('sub'); var snb = $("#snb li"); var subNav = $("#subnav div.sub"); var nDepth = $("#subnav div.sub li"); snb.each(function() { if($(this).index() === mnuIndex - 1) { $(this).addClass('on'); } }); subNav.each(function() { if($(this).index() === mnuIndex - 1) { $(this).css('display','block'); } }); nDepth.each(function() { if($(this).parent().parent('.sub').index() === mnuIndex - 1 && $(this).index() === subIndex - 1) { $(this).addClass('active'); } }); } var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; $(function(){ var tabCheck = getUrlParameter('top')-1; //var tabCheck = getUrlParameter('sub')-1; var tab = $("#snb > li"); //var tab2 = $("#subnav ul li"); tab.eq(tabCheck).addClass('on'); //tab2.eq(tabCheck).addClass('active'); }); $("#snb li").mouseenter(function() { var $index = $(this).index(); /*$("#snb li").removeClass('on'); $(this).addClass('on');*/ if($("body").hasClass('main')) { if(!$("#subnav").hasClass('active')) { $("#subnav").addClass('active'); $("#subnav").stop(true,false).animate({opacity:0}, 0); $("#subnav").stop(true,false).animate({opacity:1, left:'200px'}, 400); } } $("#subnav div.sub").css({display:'none'}); $("#subnav div.sub").eq($index).css("display","block"); }); $("#subnav").mouseleave(function() { if($("body").hasClass('main')) { $("#snb li").removeClass('on'); $("#subnav").removeClass('active'); $("#subnav").stop(true,false).animate({opacity:0, left:'0'}, 400, function() { $("#subnav div.sub").css({display:'none'}); }); } }); $("#header").mouseleave(function() { if ($("div.sub li").hasClass("active") === true) { $("div.sub li").parent().parent().css("display","none"); $("div.sub li.active").parent().parent().css("display","block"); } }); $("#mnav_call").click(function() { var $height = $("html").height(); var $winSize = $(window).width(); if(!$("#wrap").is(':animated')) { if(!$(this).hasClass('active')) { $(this).addClass('active'); $("#mnav").css('height',$height + 'px'); if($winSize > 640) { $("#wrap").stop(true, false).delay(300).animate({left:'35%'}, 400); } else { $("#wrap").stop(true, false).delay(300).animate({left:'50%'}, 400); } $('body').stop(true, false).delay(300).css('overflow-x','hidden'); } else { $(this).removeClass('active'); $("#wrap").stop(true, false).delay(300).animate({left:0}, 400); } } }); $("#mnav ul.depth1 > li").click(function() { if($(this).hasClass('open')) { $(this).removeClass('open'); $(this).find('.depth2').stop(true,false).slideUp(300); } else { $("#mnav ul.depth1 > li").removeClass('open'); $(this).addClass('open'); $("#mnav ul.depth2").stop(true,false).slideUp(300); $(this).find('.depth2').stop(true,false).slideDown(300); } }); $(".family > a").click(function() { if(!$(this).siblings('.dropdown').is(':visible')) { $(this).siblings('.dropdown').stop(true,false).slideDown(700); } else { $(this).siblings('.dropdown').stop(true,false).slideUp(700); } }); activeSub(); $(window).resize(function() { syncNav(); }); $(window).load(function() { syncNav(); }); $(window).bind('resize', function() { var $winWidth = $(this).width(); if($winWidth > 1024) { $("#wrap").removeAttr('style'); $("#mnav_call").removeAttr('class'); $("body").removeAttr('style'); $("ul.tab-add").removeAttr('style'); } else { } }); }); $(function() { var subIndex = 0; var subCount = $("#sub_aside ul.imgList li").length; function subSlide() { var subWidth = $("#sub_aside ul.imgList li:first").width(); if(subIndex<0) { subIndex = subCount - 1; } else if (subIndex>=subCount) { subIndex = 0; } $("#sub_aside ul.imgList").stop(true,false).animate({left:-(subIndex*subWidth) + 'px'}, 400); } function subInit() { var wSize = $(window).width(); var barWidth = ($(window).width() * 0.37) - 200; var conWidth = $("#container .inner").width(); if(wSize > 1024 && wSize < 1281) { var liSize = conWidth + 100; $("#sub_aside ul.imgList li").css('width',liSize + 'px'); $("#sub_aside ul.imgList").css('left',-(subIndex*liSize) + 'px'); } else if(wSize < 1025) { $("#sub_aside ul.imgList li").css('width',wSize + 'px'); $("#sub_aside ul.imgList").css('left',-(subIndex*wSize) + 'px'); } else { $("#sub_aside ul.imgList li").css('width',barWidth + 'px'); $("#sub_aside ul.imgList").css('left',-(subIndex*barWidth) + 'px'); } } $("#sub_aside .prev").click(function() { if(!$("#sub_aside ul.imgList").is(':animated')) { subIndex--; subSlide(); } }); $("#sub_aside .next").click(function() { if(!$("#sub_aside ul.imgList").is(':animated')) { subIndex++; subSlide(); } }); $(window).load(function() { subInit(); }); $(window).resize(function() { subInit(); }); }); // Products Fade $(function() { var pIndex = 0; var pTimer; function productInit() { if($("#productFade").length > 0) { var pCount = $("#productFade ul.imgList li").length; var html = "
  • "; var i; $("#productFade ul.imgList li:last").after($("#productFade ul.imgList li[data-index=0]")); for(i=1; i<=pCount; i++) { $("#productFade ul.pagination").append(html); } $("#productFade ul.pagination li:first").addClass('on'); } } function productFade() { var count = $("#productFade ul.imgList li").length; pIndex++; if(pIndex>=count) { pIndex = 0 } $("#productFade ul.pagination li").removeClass('on'); $("#productFade ul.pagination li").eq(pIndex).addClass('on'); $("#productFade ul.imgList li").removeClass('active'); $("#productFade ul.imgList li:last").after($("#productFade ul.imgList li[data-index=" + pIndex + "]")); $("#productFade ul.imgList li[data-index=" + pIndex + "]").addClass('active'); $("#productFade ul.imgList li[data-index=" + pIndex + "]").stop(true,false).animate({opacity:0}, 0); $("#productFade ul.imgList li[data-index=" + pIndex + "]").stop(true,false).animate({opacity:1}, 800); } $(document).on('click', '#productFade ul.pagination li', function() { var idx = $(this).index(); if(!$("#productFade ul.imgList li").is(':animated')) { $("#productFade ul.imgList li").stop(); clearInterval(pTimer); pTimer = setInterval(function() { productFade(); }, 8000); pIndex = idx-1; productFade(); return false; } }); $("#productFade .pause").click(function() { clearInterval(pTimer); }); pTimer = setInterval(function() { productFade(); }, 8000); productInit(); }); // Latest board tab $(function() { $("#aside .latest_box ul.tab li").click(function() { var idx = $(this).index(); $("#aside .latest_box .tab_content").css('display','none'); $("#aside .latest_box .tab_content").eq(idx).css('display','block'); $("#aside .latest_box ul.tab li").removeClass('on'); $(this).addClass('on'); }); }); // Promotional Video Layer Popup $(function() { $("#aside .video_box").click(function() { var wHeight = $(window).height(); if(!$("#videolayer").is(':visible')) { $("#mask").css('display','block'); $("#videolayer").html(''); $("#videolayer").html(''); $("#videolayer iframe").load(function() { $("#videolayer").css({top:(wHeight / 5) + 'px', display:'block'}); }); } }); $("#mask").click(function(e) { if($("#videolayer").is(':visible')) { $(this).css('display','none'); $("#videolayer").css('display','none'); } var video = $("#youtube-player").attr("src"); $("#youtube-player").attr("src",""); //$("#youtube-player").attr("src",video); $("#videolayer").html(''); }); }); // Location page $(function() { var popIndex = 0; var popCount = $("#imgPopup .img_wrap ul li").length; function popImgFade() { if(popIndex < 0) { popIndex = popCount - 1; } else if(popIndex >= popCount) { popIndex = 0; } var imgTitle = $("#imgPopup .img_wrap ul li").eq(popIndex).find('img').attr('alt'); console.log(popIndex); $("#imgPopup .img_wrap ul li").removeClass('on'); $("#imgPopup .img_wrap ul li").eq(popIndex).css({opacity:0}); $("#imgPopup .img_wrap ul li").stop(true,true).eq(popIndex).animate({opacity:1}, 500, 'easeOutCubic'); $("#imgPopup .img_wrap ul li").eq(popIndex).addClass('on'); $("#imgPopup p.tit").text(imgTitle); } $("#img_popup_wrap .pop_prev").click(function() { popIndex--; popImgFade(); }); $("#img_popup_wrap .pop_next").click(function() { popIndex++; popImgFade(); }); $("#img_popup_wrap .pop_close").click(function() { $("#img_popup_wrap").css({visibility:'hidden'}); }); $("#photo_list li").click(function() { var idx = $(this).index(); var pop_w = ($(window).width() - $("#imgPopup").width()) / 2; var pop_h = ($(window).height() - $("#imgPopup").height()) / 2; popIndex = idx; $("#img_popup_wrap").css({display:'block', visibility:'visible'}); $("#imgPopup").css({left:pop_w + 'px', top:pop_h + 'px'}); popImgFade(); }); }); $(function() { var photoIndex = 1; var swipeIndex = 0; if($("#photo_swipe").length > 0) { var wSize = $("#photo_swipe").width(); var count = $("#photo_swipe ul li").length; $("#photo_swipe ul").css({width:wSize * count + 'px'}); $("#photo_swipe ul li").css({width:wSize+'px'}); } function slide_resize(img) { var zh = 64; var vh = (img.height() - zh) / 2; img.find('.zoom').css({top:vh + 'px'}); } function slide_init() { var pcount = Math.ceil($("#photo_list li").length / 4); var mcount = $("#photo_swipe ul li").length; $("#container .company .photo_slide .paging span.all").text(pcount); $("#container .company .photo_slide .paging_m span.all").text(mcount); } function photo_slide() { var count = Math.ceil($("#photo_list li").length / 4); var mcount = $("#photo_swipe ul li").length; var imgSize = $("#photo_swipe ul li:first").width(); if(photoIndex<1) { photoIndex = 1; } else if(photoIndex>count) { photoIndex = count; } else { $("#photo_list li").css({display:'none'}); $("#photo_list li.page" + photoIndex).css({display:'block'}); $("#container .company .photo_slide .paging span.current").text(photoIndex); } } function swipe_left() { var imgSize = $("#photo_swipe ul li:first").width(); var mcount = $("#photo_swipe ul li").length; if(swipeIndex<0) { swipeIndex = mcount - 1; } $("#photo_swipe ul").css({left:-imgSize+'px'}); $("#photo_swipe ul li:first").before($("#photo_swipe ul li:last")); $("#photo_swipe ul").stop(true,false).animate({left:0}, 300, 'easeOutCubic', function() { $("#container .company .photo_slide .paging_m span.current").text(swipeIndex+1); }); } function swipe_right() { var imgSize = $("#photo_swipe ul li:first").width(); var mcount = $("#photo_swipe ul li").length; if(swipeIndex>=mcount) { swipeIndex = 0; } $("#photo_swipe ul").stop(true,false).animate({left:-(imgSize) + 'px'}, 300, 'easeOutCubic', function() { $("#photo_swipe ul li:last").after($("#photo_swipe ul li:first")); $("#photo_swipe ul").css({left:0}); $("#container .company .photo_slide .paging_m span.current").text(swipeIndex+1); }); } $("#photo_prev").click(function() { photoIndex--; photo_slide(); }); $("#photo_next").click(function() { photoIndex++; photo_slide(); }); $("#photo_prev_m").click(function() { if(!$("#photo_swipe > ul").is(':animated')) { swipeIndex--; swipe_left(); } }); $("#photo_next_m").click(function() { if(!$("#photo_swipe > ul").is(':animated')) { swipeIndex++; swipe_right(); } }); $("#photo_list li").mouseenter(function() { $(this).find('a').css({display:'block'}); slide_resize($(this)); }).mouseleave(function() { $(this).find('a').css({display:'none'}); }); slide_init(); }); // Text underline animation effect $(function() { function textEffect() { $("ul.text_effect p .color1").stop(true,false).animate({width:'100%'}, 1000, 'easeInOutCubic', function() { $("ul.text_effect p .color2").stop(true,false).animate({width:'100%'}, 1000, function() { $("ul.text_effect p .color1").css({width:0}); $("ul.text_effect p .color2").css({width:0}); textEffect(); }); }); } if($("ul.text_effect").length > 0) { textEffect(); } }); // On window resizing, photo swipe slider resize $(window).resize(function() { if($("#photo_swipe").length > 0) { var wSize = $("#photo_swipe").width(); var count = $("#photo_swipe ul li").length; $("#photo_swipe ul").css({width:wSize * count + 'px', left:0}); $("#photo_swipe ul li").css({width:wSize + 'px'}); } if($("#imgPopup").length > 0) { var pop_w = ($(window).width() - $("#imgPopup").width()) / 2; var pop_h = ($(window).height() - $("#imgPopup").height()) / 2; $("#imgPopup").css({left:pop_w + 'px', top:pop_h + 'px'}); } }); // »ó´ÜÀ¸·Î ½ºÅ©·Ñ ¹öÆ° À̺¥Æ® $(function() { // ¹öÆ° Ŭ¸¯½Ã È­¸é »ó´ÜÀ¸·Î ½ºÅ©·Ñ $("#scrollTop a").click(function(e) { e.preventDefault(); $("html, body").stop(true,false).animate({scrollTop:0}, 400, 'easeOutCubic'); }); // ¸¶¿ì½º À̺¥Æ® ó¸® $("#scrollTop a").mouseenter(function() { if(!$(this).hasClass('on')) { $(this).addClass('on'); } }).mouseleave(function() { $(this).removeClass('on'); }); }); // ½ºÅ©·Ñ À̺¥Æ® $(function() { var scrollH = $(document).height() - $(window).height(); var subMaxOpacity = 80 / scrollH; $(window).scroll(function() { var wTop = $(this).scrollTop(); var winWidth = $(this).width(); // ½ºÅ©·Ñ È°¼ºÈ­ ó¸® ÇÔ¼ö function scrollActive() { if(!$("#header").hasClass('scroll')) { $("#header").addClass('scroll'); $("#scrollTop").stop(true,false).fadeIn(300); } } // ½ºÅ©·Ñ ºñÈ°¼ºÈ­ ó¸® ÇÔ¼ö function scrollInactive() { $("#header").removeClass('scroll'); $("#scrollTop").stop(true,false).fadeOut(300); } if($("body").hasClass('main')) { if(winWidth > 1024) { if(wTop >= 750) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>768 && winWidth <= 1024) { if(wTop >= 500) { scrollActive(); } else { scrollInactive(); } } else { if(wTop >= 380) { scrollActive(); } else { scrollInactive(); } } } else { if(winWidth > 1024) { if(wTop >= 750) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>768 && winWidth <= 1024) { if(wTop >= 500) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>640 && winWidth <= 768) { if(wTop >= 380) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>480 && winWidth <= 640) { if(wTop >= 250) { scrollActive(); } else { scrollInactive(); } } else { if(wTop >= 225) { scrollActive(); } else { scrollInactive(); } } } // ¼­ºê ºñÁÖ¾ó ½ºÅ©·Ñ½Ã ¸¶½ºÅ© ¹è°æ Åõ¸íµµ ó¸® var subOpacity = (subMaxOpacity*wTop)*0.03; $("#sub_visual > .scrollbg").css('opacity',subOpacity); }); }); // ¼­ºêÆäÀÌÁö °øÅë ÇÔ¼ö $(function() { // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀÌµå º¯¼ö Á¤ÀÇ var sIndex = 0; var sTimer; var sInterval = 6000; // ¼­ºê ºñÁÖ¾ó À̹ÌÁö Ãʱâ¼ÂÆà function subImgInit() { $("#sub_visual ul li:last").after($("#sub_visual ul li[data-idx=" + sIndex + "]")); } // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀ̵å ÇÔ¼ö function subFade() { var count = $("#sub_visual ul li").length; sIndex++; if(sIndex>=count) { sIndex = 0 } $("#sub_visual ul li").removeClass('active'); $("#sub_visual ul li:last").after($("#sub_visual ul li[data-idx=" + sIndex + "]")); $("#sub_visual ul li[data-idx=" + sIndex + "]").addClass('active'); $("#sub_visual ul li[data-idx=" + sIndex + "]").stop(true,false).animate({opacity:0}, 0); $("#sub_visual ul li[data-idx=" + sIndex + "]").stop(true,false).animate({opacity:1}, 500); } // ¼­ºê ºñÁÖ¾ó ŸÀÌƲ È°¼ºÈ­ function initTitle() { var majorTitle = $("#nav .depth1 > a > span").text(); var minorTitle = $("#nav .depth2 > a > span").text(); $("#sub_visual > .title > h2").text(majorTitle); $("#sub_visual > .title > h3").text(minorTitle); } // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÀÚµ¿ ÆäÀ̵å sTimer = setInterval(function() { subFade(); }, sInterval); // 1Â÷ µå·Ó´Ù¿î ¸Þ´º È°¼ºÈ­ function majorActive() { var currIndex = $("#container").data('menu') - 1; $("#gnb > li").eq(currIndex).addClass('active'); var currMenu = $("#nav .depth1 ul.mnuList li").eq(currIndex).text(); $("#nav .depth1 > a > span").text(currMenu); } // 2Â÷ µå·Ó´Ù¿î ¸Þ´º È°¼ºÈ­ function minorActive() { var currIndex2 = $("#container").data('menu') - 1; var currIndex = $("#container").data('sub') - 1; $("#gnb > li").eq(currIndex2).find('ul').children().eq(currIndex).addClass('on'); var currMenu = $("#nav .depth2 ul.mnuList li").eq(currIndex).text(); $("#nav .depth2 > a > span").text(currMenu); } // µå·Ó¹Ú½º ¸Þ´º Ŭ¸¯ ó¸® $("#nav .dropdown > a").click(function() { if(!$(this).parent('.dropdown').hasClass('open')) { $("#nav .dropdown").removeClass('open'); $("#nav .dropdown > ul.mnuList").stop(true,false).fadeOut(200); $(this).parent('.dropdown').addClass('open'); $(this).siblings('ul.mnuList').stop(true,false).fadeIn(200); } else { $(this).parent('.dropdown').removeClass('open'); $(this).siblings('ul.mnuList').stop(true,false).fadeOut(200); } }); // ¼­ºê ÆäÀÌµå ºñÁÖ¾ó ¹× µå·Ó¹Ú½º ¸Þ´º µ¿±âÈ­ $(window).load(function() { subImgInit(); majorActive(); minorActive(); initTitle(); }); $(window).load(function() { var elem = $(".scrollreveal"); var sty = { 'opacity':'0', 'transition':'none' } elem.css(sty); $("html, body").animate({scrollTop:'10'}, 10, function() { $("html, body").animate({scrollTop:'0'}, 0); }); $(window).bind('scroll', function() { var winWidth = $(this).width(); var winTop = $(this).scrollTop(); var winHeight = $(this).height(); var docHeight = $(document).height(); var hdHeight = $("#header").height(); var elemHeight; var showDelay = 0; if(winWidth > 1024) { if(winTop >= hdHeight) { if(!$("#header").hasClass('fixed')) { $("#header").addClass('fixed'); $("#scrollTop").stop(true,false).fadeIn(300); $("#scrollTop_shop").stop(true,false).fadeIn(300); } } else { $("#header").removeClass('fixed'); $("#scrollTop").stop(true,false).fadeOut(300); $("#scrollTop_shop").stop(true,false).fadeOut(300); } } elem.each(function() { var etop = $(this).offset().top; var eh = $(this).height(); var delay = $(this).data('delay'); if(delay == null) { delay = 100; } if(winTop >= etop - winHeight) { if(!$(this).hasClass('animated')) { var aniOptions; var styR = { 'position':'relative', 'top':'30px' } var sty = { 'top':'30px' } if($(this).css('position') == 'static') { aniOptions = { 'opacity':'1', 'top':'0' } $(this).css(styR); } else if($(this).css('position') == 'absolute') { aniOptions = { 'opacity':'1', } } else { aniOptions = { 'opacity':'1', 'top':'0' } $(this).css(sty); } showDelay += delay; $(this).stop().delay(showDelay).animate(aniOptions, 500, function() { var sty = { 'position':'', 'top':'', 'opacity':'', 'transition':'' } $(this).css(sty); }); $(this).addClass('animated'); } } }); }); }); // ÆäÀÌÁö·Îµå $(window).load(function() { $("#page-loader").fadeOut(600, function() { $("#page-loader").delay(100).remove(); }); }); }); $(window).load(function() { var elem = $(".scrollreveal"); var sty = { 'opacity':'0', 'transition':'none' } elem.css(sty); $("html, body").animate({scrollTop:'10'}, 10, function() { $("html, body").animate({scrollTop:'0'}, 0); }); $(window).bind('scroll', function() { var winWidth = $(this).width(); var winTop = $(this).scrollTop(); var winHeight = $(this).height(); var docHeight = $(document).height(); var hdHeight = $("#header").height(); var elemHeight; var showDelay = 0; if(winWidth > 1024) { if(winTop >= hdHeight) { if(!$("#header").hasClass('fixed')) { $("#header").addClass('fixed'); $("#scrollTop").stop(true,false).fadeIn(300); $("#scrollTop_shop").stop(true,false).fadeIn(300); } } else { $("#header").removeClass('fixed'); $("#scrollTop").stop(true,false).fadeOut(300); $("#scrollTop_shop").stop(true,false).fadeOut(300); } } elem.each(function() { var etop = $(this).offset().top; var eh = $(this).height(); var delay = $(this).data('delay'); if(delay == null) { delay = 100; } if(winTop >= etop - winHeight) { if(!$(this).hasClass('animated')) { var aniOptions; var styR = { 'position':'relative', 'top':'30px' } var sty = { 'top':'30px' } if($(this).css('position') == 'static') { aniOptions = { 'opacity':'1', 'top':'0' } $(this).css(styR); } else if($(this).css('position') == 'absolute') { aniOptions = { 'opacity':'1', } } else { aniOptions = { 'opacity':'1', 'top':'0' } $(this).css(sty); } showDelay += delay; $(this).stop().delay(showDelay).animate(aniOptions, 500, function() { var sty = { 'position':'', 'top':'', 'opacity':'', 'transition':'' } $(this).css(sty); }); $(this).addClass('animated'); } } }); }); }); $(window).load(function() { var wHeight = $(this).height(); $("html, body").stop(true,false).animate({scrollTop:wHeight + 'px'}, 0); $("html, body").stop(true,false).animate({scrollTop:'0'}, 0); }); $(window).scroll(function() { var pos = $(this).scrollTop(); var win = $(window); $(".scrollObj").each(function() { var objPos = $(this).offset().top; var objh = $(this).height(); var winh = win.height(); var _direction = $(this).data('scroll'); var _delay = $(this).data('delay'); if(pos+winh > objPos - 100) { if(!$(this).hasClass('scrollComplete')) { if(_direction==='left') { $(this).css({opacity:0, position:'relative', left:'-50px'}); $(this).delay(_delay).animate({opacity:1, left:''}, 800, 'easeOutCubic'); } else if(_direction==='right') { $(this).css({opacity:0, position:'relative', right:'-50px'}); $(this).delay(_delay).animate({opacity:1, right:''}, 800, 'easeOutCubic'); } else if(_direction==='top') { $(this).css({opacity:0, position:'relative', top:'50px'}); $(this).delay(_delay).animate({opacity:1, top:''}, 800, 'easeOutCubic'); } else if(_direction==='bottom') { $(this).css({opacity:0, position:'relative', top:'-50px'}); $(this).delay(_delay).animate({opacity:1, top:''}, 800, 'easeOutCubic'); } $(this).addClass('scrollComplete'); } } }); });