// JavaScript Document
$(function() {
$('a[href^="#"],a[href*="#"]').on('click',function() {
var mrg = $("#head").outerHeight() + 10;
mrg = $("#head #logo").outerHeight() + 40;
href = $(this).attr("href");
var hrefs=href.substring(href.indexOf("#")+1,href.length);
href = "#"+hrefs;
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top - mrg;
$('body,html').animate({scrollTop:position}, 500, 'swing');
return false;
});
$('#pagetop .svg-inline--fa').on('click',function() {
var position = 0;
$('body,html').animate({scrollTop:position}, 500, 'swing');
return false;
});
$(document).on('click','#menu > div > ul > li.facility > a',function (e) {
e.preventDefault();
$('#menu > div > ul > li > ul').slideToggle(500,function(){
if($('#menu > div > ul > li > ul').css('display') == 'none'){
$('#menu > div > ul > li.facility > a .down').removeClass('off');
$('#menu > div > ul > li.facility > a .up').addClass('off');
}else{
$('#menu > div > ul > li.facility > a .down').addClass('off');
$('#menu > div > ul > li.facility > a .up').removeClass('off');
}
});
});
/**スライダー**/
if($('.swiper-container').length){
var tipicsswiper = new Swiper('.swiper-container', {
loop: true,
effect: 'fade'
, speed:1000,
slidesPerView: 1,
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
}
$('.entry #contents .mw_wp_form td input#facility').attr('readonly',true);
setsize();
//本アップ対応
$("li.off a, #entrymenu > li > a").click(function(e) {
e.preventDefault;
return false;
});
//telリンク
if(uaname != "sp"){
$(".tel a").click(function(e) {
e.preventDefault;
return false;
});
}
if($('.mwform-zip-field').length){
$('.mwform-zip-field > input:first-child').attr('id','zip');
$('.mwform-zip-field > input:last-child').attr('id','zip1');
}
if($('input.hidden').length){
$('input.hidden').attr('readonly','readonly');
}
if($('.entry #contents tr:first-child td select').length){
$('.entry #contents tr:first-child td select').attr('readonly','readonly');
}
if($('.mw_wp_form').length){
var val = $('#jobget').val();
if(val){
$('#jobset').val(val);
}
}
});
$(window).on('load',function(){
setsize();
//movepos();
});
$(window).on('resize',function () {
setsize();
//movepos();
});
$(window).on('scroll',function () {
//setsize();
});
$(window).on('orientationchange', function(){
setsize();
});
function setsize(){
if($("#container > header > #header").css('position')=='fixed'){
$('#container > header > #header,#main').removeAttr('style');
$('#container > header > #header,#main').matchHeight({ remove: true });
var hsize = $("#header").outerHeight();
$("#main").css("padding-top",hsize+"px");
}else{
$('#container > header > #header,#main').removeAttr('style');
//menu=contents
$('#container > header > #header,#main').matchHeight();
}
//facility
$('#main .schedule > dl > dd dl').matchHeight();
//facility tokyoasuka
$('#main.facility2.tokyoasuka ul.info li > p').matchHeight();
}
//他ページよりのアンカーリンク
function movepos(){
var mrg = $("#head").outerHeight() + 10;
var href = location.href;
if(href.indexOf("#")>=0 || location.search){
var hrefs=href.substring(href.indexOf("#")+1,href.length);
href = hrefs;
var position = $("#"+href).offset().top;
var speed = 500;
$('body,html').animate({scrollTop:position-mrg}, speed, 'swing');
}else{
return false;
}
var hashString = location.hash.substr(1);
history.replaceState('', document.title, window.location.pathname);
}