//���� �ʱ�ȭ function mainInit(){ mainBanner(); mainFoundation(); $('.m_americano,.ms_banner,.m_open_store,.m_story').bind('mouseenter mouseleave',function(event){ if(event.type=='mouseenter'){ $(this).find('p').stop().animate({'margin-top':-30},500,'easeOutSine') $(this).find('span').stop().animate({'opacity':1}) }else{ $(this).find('p').stop().animate({'margin-top':0},500,'easeOutSine') $(this).find('span').stop().animate({'opacity':0.7}) } }); } //���� â���ȳ� function mainFoundation(){ var f_c = 0; var p_c = -1; var f_t = $('.m_f_list'); var f_rt = $('.m_f_data'); $('.m_f_list').find('a').bind('mouseenter',function(){ p_c = f_c; if(f_c != $(this).index()){ f_c = $(this).index(); Action._start(); } }); var Action = { ease:'easeOutExpo', speed:900, _start:function(){ var _t = 54+(f_c* 42) $('span.right_arrow').stop().animate({'top':_t},900,'easeOutExpo'); f_t.find('> a:eq('+f_c+')').css('background-position','right top').siblings().css('background-position','left top') f_rt.find('a').each(function(){ if($(this).index() == f_c){ $(this).stop().fadeTo(0, 0.01).delay(30).fadeTo(300, 1); }else{ $(this).stop().css('display','none') } }); } } Action._start(); } //���ι�� function mainBanner(){ var target = $('.main_banner'); var tab = target.find('.tab'); var cur = 0; var len = target.find('.big_img > div').length; var time = 500000000000; var Action; var Stimer; var Action={ ease:'easeOutExpo', speed:900, autoTimer:function(){ cur = (cur >= len-1)?0:cur = cur+1; Action._start(); }, _start:function(){ target.find('div.big_img > div').each(function(){ if($(this).index() == cur){ $(this).stop().css({'display':'block','opacity':0}).animate({'opacity':1},900,'easeOutExpo') }else{ $(this).stop().css('display','none'); } }); Action._align(cur); }, _align:function(_index){ var _dx = -835 + tab.find('> ul > li:eq('+_index+')').position().left; tab.find('> ul').stop().animate({'background-position':_dx+'px'},900,'easeOutExpo'); tab.find('> ul > li').each(function(){ var img_flag; var img_index = $(this).index()+1; if($(this).index() == _index){ img_flag = "_on" //$(this).stop().css({'opacity':0,'background-position':'250px top'}).delay(100).animate({'opacity':1},900); }else{ img_flag = "_off" //$(this).stop().css({'opacity':1,'background-position':'250px top'}); } $(this).find('> a img').attr('src','img/main_banner_tab0'+img_index+''+img_flag+'.png'); }); } } //tab tab.find('> ul > li').bind('mouseenter click',function(event){ if(event.type == 'mouseenter'){ Action._align($(this).index()); }else if(event.type == 'click'){ cur = $(this).index(); Action._start(cur); } }); tab.find('> ul').bind('mouseleave',function(){ Action._align(cur); }); // arrow event handler target.find('.banners > a').click(function(){ if($(this).index() == 1){ //left cur = (cur == 0)?len-1:cur=cur-1; }else{ //right cur = (cur >= len-1)?0:cur = cur+1; } Action._start(); }); Action._start(); target.bind('mouseleave mouseenter',function(event){ if(event.type == 'mouseenter'){ clearInterval(Stimer); }else{ clearInterval(Stimer); Stimer = setInterval(Action.autoTimer,time); } }); Stimer = setInterval(Action.autoTimer,time); if($('body').hasClass('mobile')){ var _target = $('.main_banner'); var _offX; var _curX; _target.swipe(function(direction){ if(direction == "left"){ cur = (cur == 0)?len-1:cur=cur-1; Action._start(); }else if(direction == "right"){ cur = (cur >= len-1)?0:cur = cur+1; Action._start(); } //alert(direction); }, { preventDefault: false, mouse: true, pen: true, distance: 50 }); } } /************************ @ scroll Event ************************/ $(window).scroll(function() { offy = $(window).scrollTop(); if(offy >= 580){ $('#quick').css('top',offy) }else{ $('#quick').css('top',580) } });//end scroll