// JavaScript Document

//loading
$(window).on('load',function(){
	$('.loading_logo').delay(0).fadeIn(1000);
	$('.loading_text').delay(500).fadeIn(1000);
    $('.start_filter').delay(1000).fadeOut(2000);
	$('.main_img_img').delay(2500).fadeIn(2000);
    /*$('#container').delay(2000).fadeIn(1500);
	$('header').delay(5000).fadeIn(2500);
	$('.menu-btn').delay(5000).fadeIn(2500);*/
});

//コンテンツフェードイン
$(window).on('scroll', function (){

  var elem = $('.contents_fadein');
  var isAnimate = 'isAnimate';
  
  elem.each(function () {
  
    var elemOffset = $(this).offset().top;
    var scrollPos = $(window).scrollTop();
    var wh = $(window).height();

    if(scrollPos > elemOffset - wh + (wh / 8) ){
      $(this).addClass(isAnimate);
    }
  });

});

//スムーズスクロール
$(function(){
   // #で始まるアンカーをクリックした場合に処理
   $('a[href^=#]').click(function() {
      // スクロールの速度
      var speed = 800; // ミリ秒
      // アンカーの値取得
      var href= $(this).attr("href");
      // 移動先を取得
      var target = $(href == "#" || href == "" ? 'html' : href);
      // 移動先を数値で取得
      var position = target.offset().top - 60;
      // スムーススクロール
      $('body,html').animate({scrollTop:position}, speed, 'swing');
      return false;
   });
});

$(window).on('load', function() {
    var hash = window.location.hash;
    var position = $(hash).offset().top;
    function scroll(position){
      $('html, body').animate({
        scrollTop : position
      }, 100);
    }
    scroll(position);
  });

//Q&A
$(function(){
$(".q").click(function(){
    $(this).next(".a").slideToggle();
	$(this).children(".qa_button").toggleClass("p_m");
	});
});


$(function(){
$(".link_information1").click(function(){
    $(".information_ex").fadeIn(800);
	});
});

$(function(){
$(".link_information2").click(function(){
    $(".information_ex2").fadeIn(800);
	});
});


$(function(){
$(".information_ex_switch").click(function(){
    $(".information_ex,.information_ex2").fadeOut(800);
	});
});

$(function(){
$(".btn_close").click(function(){
    $(".information_ex,.information_ex2").fadeOut(800);
	});
});















