$(function(){ // for opening if($('#opening').length){ var tgt = $('#opening'); var rat = parseInt(tgt.css('min-width')) / parseInt(tgt.css('min-height')); var url = tgt.attr('data-redirect'); var opnum = 0; var winW; var winH; var winR; var winSize = function(){ winW = $(window).width(); winH = $(window).height(); winR = winW / winH if(winR > rat){ tgt.css({ 'height':'100%', 'width': tgt.height() * rat }) } else { tgt.css({ 'width':'100%', 'height': tgt.width() / rat }); } } winSize(); $(window).on('resize orientationchange',function(){ winSize(); }) tgt.imagesLoaded(function(){ var opmov = function(){ switch (opnum){ case 0: $('.skip').delay(1000).fadeIn(5000); tgt.find('.cut').eq(opnum).find('.img').stop().animate({ 'top': -50, 'right':-50, 'left':-50 },7000); tgt.find('.cut').eq(opnum).find('.txt').delay(2000).animate({ 'opacity': 1 },1000); break; case 1: tgt.find('.cut').eq(opnum).find('.img').stop().animate({ 'top':-400, 'bottom': 0 },7000); tgt.find('.cut').eq(opnum).find('.txt').delay(2000).animate({ 'opacity': 1 },1000); break; case 2: $('.skip').delay(3000).fadeOut(1000) tgt.find('.cut').eq(opnum).find('.cover').delay(3000).fadeIn(1000,function(){ $(this).siblings('.txt').fadeTo(1000,1) }); tgt.find('.cut').eq(opnum).find('.img').stop().animate({ 'top':0, 'bottom':0, 'left':0, 'right':0 },12000); break; case 3: clearInterval(oploop); setTimeout(function(){$('#skip_btn').trigger("click");},5000); break; } tgt.find('.cut').eq(opnum).stop().fadeIn(2000,function(){ opnum = opnum + 1; }); } opmov(); var oploop = setInterval(function(){ opmov(); },5000) }); } // for opening });