var timer; $( function(){ //スクロール処理 $('a[href^=#]').click(function() { //処理無効 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 == "#" || href == "" ? 'html' : href); // 移動先を数値で取得 var position = target.offset().top; } // スムーススクロール $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); $(window).resize( function(){ setTopImage(); listImageChange(); }); $(document).on( 'click', '.yahoo a', function(){ $.post( 'index.html', { mode:'access', title:$(this).text(), url:$(this).attr('href'), yahoo:$(this).attr('rel') }, function( data ) { } ); return false; } ); $(".zoom").colorbox({ href: function() { var href = $(this).attr('href'); return href; }, transition:'elastic', maxWidth:'80%', maxHeight:'80%', opacity:0.78 }); $('#login_button').click( function(){ $(this).closest('form').submit(); return false; } ); $('#search_button').click( function(e){ return checkSearch(); } ); $('#send_button').click( function(e){ $.post( $('#sendform').attr('action'), $('#sendform').serialize(), function( data ) { var tmp = data.split(''); if ( tmp[0] == 'OK' ) { if ( confirm( 'この内容で送信してよろしいですか?' ) ) { $('input[name="mode"]').val( 'send' ); $.post( $('#sendform').attr('action'), $('#sendform').serialize(), function( data ) { var tmp = data.split(''); if ( tmp[0] == 'OK' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); $('input[type="text"],textarea').val( '' ); } else if ( tmp[0] == 'NG' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); } else { alert( data ); } } ); $('input[name="mode"]').val( 'check' ); } } else if ( tmp[0] == 'NG' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); } else { alert( data ); } } ); return false; } ); $('#send_button2').click( function(e){ $.post( $('#sendform').attr('action'), $('#sendform').serialize(), function( data ) { var tmp = data.split(''); if ( tmp[0] == 'OK' ) { if ( confirm( 'この内容で送信してよろしいですか?' ) ) { $('input[name="mode"]').val( 'send' ); $.post( $('#sendform').attr('action'), $('#sendform').serialize(), function( data ) { var tmp = data.split(''); if ( tmp[0] == 'OK' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); $('input[type="text"],textarea,select').val( '' ); } else if ( tmp[0] == 'NG' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); } else { alert( data ); } } ); $('input[name="mode"]').val( 'check' ); } } else if ( tmp[0] == 'NG' ) { $('#err').html( tmp[1] ); $('body,html').animate({scrollTop: $('#err').offset().top +'px'}, 300, 'swing'); } else { alert( data ); } } ); return false; } ); } ); function moreBlog( obj ) { var x = Number(obj.attr('rel')); var y = obj.closest('div').attr('id'); $.post( './', { mode:'blog_more', num:obj.attr('rel'), type:y }, function( data ){ var tmp = data.split(''); if ( tmp[0] == 'OK' ) { if ( y == 'blog_more' ) { history.replaceState(null,null,'./?no2='+(x-1)); $(tmp[1]).hide().appendTo('#blog_area > ul').slideDown(300); } else { history.replaceState(null,null,'./?no='+(x-1)); $(tmp[1]).hide().appendTo('#information_area > ul').slideDown(300); } if ( tmp.length > 2 ) { $('#'+y).html( 'MORE' ); } else { $('#'+y).remove(); } } else { alert( data ); } } ); } $(window).load( function(){ setTopImage(); imageChange(0); listImageChange(); } ); function setTopImage() { var windowSize = $(window).height(); var titleSize = $('#top_title_area').height(); if ( $('#top_image_area').length > 0 ) { $('#top_image_area').height( windowSize - titleSize ); } if ( $('#top_catch').length > 0 ) { $('#top_catch').height( windowSize ); } } function listImageChange() { $('.second ul li, .third ul li, .fouth ul li').each( function(){ $(this).css('height',$(this).width()+'px'); } ); $('.green_pict li').each( function(){ $(this).css('height', $(this).width()+'px' ); } ); $('.pict_list li img').each( function(){ $(this).css('height', $(this).width()+'px' ); } ); } function imageChange( no ){ if ( $('#top_image_area').length > 0 && $('#change_images > img').length > 0 ) { if ( $('#top_image_area').css('backgroundImage') == 'none' || $('#top_image_area').css('backgroundImage') == '' ) { //初期設定 $('#top_image_area').css('backgroundImage','url('+$('#change_images > img').eq(no).attr('src')+')'); $('#top_image_area_include').css('backgroundImage','url('+$('#change_images > img').eq(no).attr('src')+')').fadeIn(0); for ( i=1; i<=$('#change_images > img').length; i++ ) { $('#image_change ul').append( '
  • ' ); } $('#image_change li a').click( function(){ imageChange( $('#image_change li').index( $(this).closest('li') ) ); return false; } ); no = 0; } else { clearTimeout( timer ); $('#top_image_area_include').stop().fadeIn(10,function(){ $('#top_image_area').css('backgroundImage','url('+$('#change_images > img').eq(no).attr('src')+')'); $('#top_image_area_include').fadeOut( 1000, function(){ $(this).css('backgroundImage','url('+$('#change_images > img').eq(no).attr('src')+')').fadeIn(0); } ); } ); } $('#image_change a').removeClass('green').eq(no).addClass('green'); timer = setTimeout( "imageChange("+((no+1)>=$('#change_images > img').length?0:(no+1))+")", 10000 ); } } function checkSearch() { if ( $('input[name="search_text"]').val() != '' || $('select[name="search_kamei"]').val() != '' || $('select[name="search_area"]').val() != '' ) { $('#search_result').slideUp( 330, function(){ $.post( 'search.php', $('#search_form').serialize(), function( data ){ var tmp = data.split( '' ); if ( tmp[0] == 'OK' ) { $('#search_result').html(tmp[1]).slideDown(550).find('div.img').each( function(){ $(this).css( 'height', $(this).width()+'px' ); } ); } else if ( tmp[0] == 'NG' ) { $('#search_result').html(tmp[1]).slideDown(550); } else { alert( data ); } } ); } ); } else { alert( '検索条件を設定してください。'); } return false; }