// JavaScript Document
$(function() {
$('a[href^="#"],a[href*="#"]').not('.switcher a, #tribe-events a, a.tribe-mini-calendar-nav-link').on('click',function() {
var mrg = $("#head").outerHeight() + 10;
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;
});
setsize();
//240430フォーム改修
if($('#mw_wp_form_mw-wp-form-36575').length){
//初期設定
const val = $('.mw_wp_form input.settype:checked').val();
if(val=='type2'){
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4)').css('display','none');
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4) input').prop('disabled', true);
}else{
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4)').removeAttr('style');
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4) input').prop('disabled', false);
}
//切り替え時
$('.mw_wp_form input.settype').on('change',function(){
const val = $(this).val();
if(val=='type2'){
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4)').css('display','none');
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4) input').prop('disabled', true);
}else{
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4)').removeAttr('style');
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4) input').prop('disabled', false);
}
});
//確認画面
if($('.mw_wp_form_confirm').length){
if($('.mw_wp_form tr:first-child input[name="お問合せ種別"]').val()=='type2'){
$('.mw_wp_form tr:nth-child(n+2):nth-child(-n+4)').css('display','none');
}
}
}
//本アップ対応
$("a.nolink").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');
}
$('#news > div').on('click',function(){
$(this).stop().toggleClass('open');
$(this).prev('ul').find('li:nth-child(n+2)').stop().slideToggle();
if($(this).prev('div').hasClass('open')){
var hh = $(this).prev('div').children('p').outerHeight();
$(this).prev('div').css('height',hh);
}else{
$(this).prev('div').removeAttr('style');
}
});
$('.faq dt').on('click',function(){
$(this).toggleClass('open');
$(this).next('dd').slideToggle();
});
$('.faq .selectmenu li').on('click',function(){
$('.faq .selectmenu li').removeClass('active');
$(this).addClass('active');
$('.faq .faqwrap').removeClass('active');
var cls = $(this).attr('data-select');
$('.faq .faqwrap.'+cls).addClass('active');
});
$('#side > .sidetit').stop().on('click',function (e) {
if($(this).css('background-size')=='cover'){
e.preventDefault();
$(this).stop().next('div').slideToggle();
$(this).toggleClass('open');
}else{
$(this).removeClass('open');
}
});
$("a:has(img)").addClass("noicon");
if($('.mw_wp_form.mw_wp_form_input table tr:last-child td .business-description').length){
let att = $('.mw_wp_form.mw_wp_form_input table tr:last-child td .business-description span');
$('.mw_wp_form.mw_wp_form_input table tr:last-child td .business-description').remove();
$('.mw_wp_form.mw_wp_form_input table tr:last-child td .mwform-checkbox-field-text').html(att);
}
});
$(window).on('load',function(){
setsize();
movepos();
});
$(window).on('resize',function () {
setsize();
movepos();
});
$(window).on('scroll',function () {
//setsize();
});
$(window).on('orientationchange', function(){
setsize();
});
function setsize(){
var hsize = $("#head").outerHeight();
$("#main").css("padding-top",hsize+"px");
$('.event dl').matchHeight();
$('.ieltsmenu a').matchHeight();
if($('#mainimg .topslide').length){
$('#mainimg .topslide .swiper-slide').css('height',$(window).innerHeight() - $('#head').outerHeight());
}
}
//他ページよりのアンカーリンク
function movepos(){
var mrg = $("#head").outerHeight();
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);
}
function formcheck(){
var flag = $('.loginform > form input#login_password').val();
if(flag==''){
window.alert('パスワードが未入力です'); // 入力漏れがあれば警告ダイアログを表示
return false; // 送信を中止
}else{
return true; // 送信を実行
}
}