var timer; $( function(){ //スクロール処理 $(document).on( 'click', "a", function() { //処理無効 if ( ! ( $(this).attr('href').substr(0,1) == '#' ) ) return; if ( $(this).hasClass('button') || $(this).hasClass('more_button') || $(this).hasClass('zoom') || $(this).hasClass('noscroll') ) return; // スクロールの速度 var speed = 400; // ミリ秒 // アンカーの値取得 var href= $(this).attr("href"); // 移動先を取得 if ( href == "#" ) { var position = 0; } else { var target = $(href); // 移動先を数値で取得 var position = target.offset().top; } // スムーススクロール $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; } ); //トップ画像設定 for ( i=1; i<=$('.kon_header_pict_wrap').length; i++ ) $('#kon_dot').append(''); $('.kon_header_pict_wrap').eq(0).fadeIn(0); change_image(0,9999); //ウィンドウ移動後の処理 $(window).on( 'scroll resize', function(){ kon_upIcon(); kon_menu(); } ); $(document).on( 'click', '#kon_dot > a', function(){ if ( ! $(this).hasClass('now') ) change_image2( $('#kon_dot > a').index( $(this) ) ); return false; } ); //バーガーメニュー設定 $(document).on( 'click', '.burger,#kon_burger_out', function(){ check_burger(); return false; } ); $(document).on( 'click', '#kon_burger a', function(){ check_burger(); } ); $(document).on( 'click', '.burger2', function(){ if ( $('#kon_burger_wrap').is(':visible') ) check_burger(); } ); //実績切り替え $(document).on( 'click', '#kon_result_menu a', function(){ change_works( $(this).attr('rel') ); return false; } ); $(document).on( 'click', 'a.kon_result_link', function(){ change_works( $(this).attr('rel') ); } ); if ( location.hash.substr(0,6) == '#work_' ) { var tmp = location.hash.split("_"); $('body,html').animate({scrollTop:$('#kon_result').offset().top}, 0, 'swing'); change_works( tmp[1] ); } //お知らせ $(document).on( 'click', '#info_more_area a.more_button', function(){ get_information( $(this) ); return false; } ); //上に戻る表示設定 kon_upIcon(); //固定グローバルメニュー $('body').append('
'+$('#kon_header_menu').html()+'
'+$('#kon_header_global_menu').html()+'
'); kon_menu(); //インナーフレーム起動 $(document).on( 'click', '.zoom', function(){ $.colorbox( { href: $(this).attr('href'), transition:'elastic', maxWidth:'80%', maxHeight:'80%', opacity:0.78 } ); return false; } ); } ); function kon_upIcon() { if ( $('#kon_header').length > 0 ) { if ( $('#kon_header').height() <= $(window).scrollTop() ) { $('#kon_up_icon').fadeIn( 100 ); } else { $('#kon_up_icon').fadeOut( 100 ); } } else if ( $('#kon_header_sub').length > 0 ) { if ( $('#kon_header_sub').height() <= $(window).scrollTop() ) { $('#kon_up_icon').fadeIn( 100 ); } else { $('#kon_up_icon').fadeOut( 100 ); } } } function kon_menu() { if ( $('#kon_header_menu').offset().top <= $(window).scrollTop() ) { $('#kon_header_menu_fix').css({ 'visibility':'visible' }); $('#kon_header_menu').css({ 'visibility':'hidden' }) $('#kon_header_global_menu_fix').css({ 'visibility':'visible' }); $('#kon_header_global_menu').css({ 'visibility':'hidden' }) } else { $('#kon_header_menu').css({ 'visibility':'visible' }) if ( $('#kon_burger_wrap').is(':visible') ) { $('#kon_header_menu_fix').css({ 'visibility':'visible' }); } else { $('#kon_header_menu_fix').css({ 'visibility':'hidden' }); } $('#kon_header_global_menu').css({ 'visibility':'visible' }) $('#kon_header_global_menu_fix').css({ 'visibility':'hidden' }); } } function check_burger(){ var w = $('#kon_burger_wrap').width(); if ( $('#kon_burger_wrap').is(':visible') ) { $('#kon_burger_wrap').fadeOut( 300, function(){ if ( $('#kon_header_menu').offset().top > $(window).scrollTop() ) { $('#kon_header_menu_fix').css({ 'visibility':'hidden' }); } } ); $('#kon_burger').animate( { left: w+'px' }, 300 ); } else { $('#kon_burger').animate( { left: w+'px' }, 0 ); $('#kon_burger_wrap').fadeIn( 300, function(){ $('#kon_header_menu_fix').css({ 'visibility':'visible' }); } ); $('#kon_burger').animate( { left: '0' }, 300 ); } } function change_works( id ) { $('#kon_result_menu').find('a').each( function(){ if ( $(this).attr('rel' ) == id ) { $(this).closest('li').addClass('selected'); } else { $(this).closest('li').removeClass('selected'); } } ); $('#kon_result_list').slideUp( 300, function(){ $.post( './', { mode:'work', id:id }, function( data ){ var tmp = data.split(""); if ( tmp[0] == 'OK' ) { $('#kon_result_list').html( tmp[1] ); $('#kon_result_list').slideDown( 300 ); } else { alert( '読み込みエラーです' ); } } ); } ); } function get_information( obj ){ obj.closest('div').slideUp( 200, function(){ var num = obj.attr('rel'); obj.closest('div').remove(); $.post( './', { mode:'information', num:num }, function( data ){ var tmp = data.split(""); if ( tmp[0] == 'OK' ) { $(tmp[1]).appendTo( $('#kon_information_list ul') ); if ( tmp[2] != '' ) $(tmp[2]).appendTo( $('#kon_information_list') ); } else { alert( '読み込みエラーです' ); } } ); } ); return false; } function change_image( show ) { var next = 0; if ( ( show+1) < $('.kon_header_pict_wrap').length ) next = show+1; //切替リンク設定 $('#kon_dot > a').removeClass( 'now' ); $('#kon_dot > a').eq( show ).addClass('now'); //拡大処理 var tb = Math.floor( Math.random() * 2 ) + 1; var lr = Math.floor( Math.random() * 2 ) + 1; var mov = Math.floor( Math.random() * 2 ) + 1; if ( tb == 1 ) { $('.kon_header_pict_wrap').eq( show ).find('div').css({top:'0',bottom:'auto'}); } else { $('.kon_header_pict_wrap').eq( show ).find('div').css({top:'auto',bottom:'0'}); } if ( lr == 1 ) { $('.kon_header_pict_wrap').eq( show ).find('div').css({left:'0',right:'auto'}); } else { $('.kon_header_pict_wrap').eq( show ).find('div').css({left:'auto',right:'0'}); } if ( mov == 1 ) { $('.kon_header_pict_wrap').eq( show ).find('div').css({width:'100%',height:'100%'}).animate({width:'120%',height:'120%'},8000,'swing'); } else { $('.kon_header_pict_wrap').eq( show ).find('div').css({width:'120%',height:'120%'}).animate({width:'100%',height:'100%'},8000,'swing'); } //表示切替処理 timer = setTimeout( function(){ img_fadeOut( show, next ); }, 6000 ); } function img_fadeOut( show, next ){ $('.kon_header_pict_wrap').eq( show ).fadeOut( 2000 ); $('.kon_header_pict_wrap').eq( next ).fadeIn( 2000 ); change_image( next ); } function change_image2( show ){ clearTimeout( timer ); $('.kon_header_pict_wrap').each( function(){ if ( ( $('.kon_header_pict_wrap').index( $(this) ) ) == show ) { $(this).fadeOut( 500, function(){ $(this).fadeIn( 2000 ); } ); } else if ( $(this).is(':visible') ) { $(this).fadeOut( 500 ); } } ); change_image( show ); }