( function( $ ) { $( function() { $('a img[src*="_off."],span.anc img[src*="_off."],input[src*="_off."]').rollOver(); $('a.pn[href^="#"]').smScroll( { 'easing': 'easeOutCubic' } ); $('a.ar').alphaRo(); $('.diva').setDivAnchor(); } ); /** * navi */ $( function() { var $navi = $( '._head-nav' ); var $wrap = $( '._nav-wrap' ); var $trigger = $navi.find( '.trigger a' ); function open() { resize(); $navi.addClass( '_head-nav-open' ); } function close() { $navi.addClass( '_head-nav-close' ); setTimeout( function() { $navi.removeClass( '_head-nav-open' ).removeClass( '_head-nav-close' ); }, 500 ); } function resize() { $wrap.height( $(document).height() ); } $trigger.on( 'click.global', function( e ) { e.stopPropagation(); e.preventDefault(); if( $navi.is( '._head-nav-open' ) ) { close(); } else { open(); } return false; } ); $wrap.on( 'click.global', function( e ) { e.stopPropagation(); e.preventDefault(); close(); } ) $wrap.find( 'a' ).on( 'click.global', function( e ) { e.stopPropagation(); } ); $(window).resize( function() { resize(); } ).trigger( 'resize' ); /** * SubNavigation */ $('._nav-list > ul > li').each( function() { if( $(this).find( 'ul' ).length > 0 ) { var $subnavi = $(this).find('ul'); var $trigger = $(this).children('a').addClass( 'down' ); var height = $subnavi.height(); var is_view = false; $subnavi.height( 0 ); $trigger.on( 'click.subnavi', function() { if( is_view ) { $trigger.removeClass( 'up' ); $subnavi.stop( true, false ).animate( { 'height': 0 }, { 'duration': 300 } ); is_view = false; } else { $trigger.addClass( 'up' ); $subnavi.stop( true, false ).animate( { 'height': height }, { 'duration': 300 } ); is_view = true; } return false; } ); } } ); } ); /** * イベントバナー */ $(function() { var $box = $('#evetnBox'); if(! $box.length) { return; } // バナー表示域 var $banner = $box.find('.eventBanner'); // 表示位置 var $fix = $box.find( '.fix' ); // 表示サイズ var _height = 0; function eventBannerTrigger() { _height = $banner.height(); $(window).on('resize', function() { _height = $banner.height(); adjustEventBanner(); }); $box.find(".btn_close,.btn_open").off('click.banner').on('click.banner', function() { $fix.toggleClass('select'); $.cookie('eventBanner', $fix.hasClass('select'), {path:'/'}); adjustEventBanner(); }); if($.cookie('eventBanner') === 'true'){ $fix.addClass('select'); } else { // $fix.addClass('select'); } adjustEventBanner(); } function adjustEventBanner() { if($fix.is('.select')) { $fix.css({ '-webkit-transform': 'translate3d(0,'+_height+'px,0)', '-moz-transform': 'translate3d(0,'+_height+'px,0)', '-ms-transform': 'translate3d(0,'+_height+'px,0)', '-o-transform': 'translate3d(0,'+_height+'px,0)', 'transform': 'translate3d(0,'+_height+'px,0)', }); } else { $fix.css({ '-webkit-transform': 'translate3d(0,0,0)', '-moz-transform': 'translate3d(0,0,0)', '-ms-transform': 'translate3d(0,0,0)', '-o-transform': 'translate3d(0,0,0)', 'transform': 'translate3d(0,0,0)', }); } } // 画像読み込み判定 var $img = $(''); $img.on( 'load', eventBannerTrigger ); $img.attr( 'src', $box.find('.eventBanner img').attr('src') ); }); } )( jQuery );