$(function(){
//■■■■電話番å·ã®ã‚¹ãƒžãƒ›å¯¾å¿œ â– â– â– â–
if($('.tel_num')){
$('.tel_num').each(function(){
var $num = $(this).html(),
$_num = $(this).text(),
href = $_num.replace( /.*?(\d+).*?(\d+).*?(\d+)/g , "$1$2$3");
if(navigator.userAgent.indexOf('iPhone') != -1 || navigator.userAgent.indexOf('Android') != -1){
$(this).html("" + $num + "");
}
});
}
//■■■■ヘッダーã®å›ºå®š â– â– â– â–
headerY = $('header').offset().top;
//SPã®ã¿
if( $(this).width() < 890 ){
// #header-txt ã®é«˜ã•を計測
var headerTxtHeight = $('#header-txt').length ? $('#header-txt').outerHeight() : 0;
// #main_image ã®é«˜ã•を計測
var mainImageHeight = $('#main_image').length ? $('#main_image').outerHeight() : 0;
$('.ul-widget-main-window').css({
'bottom': "0",
'border' :'solid'
});
}
$(window).on('load resize', function() {
//PCã®ã¿
headerY = $('header').offset().top;
});
$(window).on('load scroll', function() {
//PCã®ã¿
if( $(this).width() >= 890 ){
if( $(this).scrollTop() > headerY ){
$('header').css({ position: "fixed", marginTop: "0" });
$('.main_image.top').css("margin-top", "100px");
}else{
$('header').css({ position: "relative", marginTop: "-100px" });
$('.main_image.top').css("margin-top", "0");
}
}
});
//SPã®ã¿
if( $(this).width() < 890 ){
$(window).on('scroll', function() {
// スクãƒãƒ¼ãƒ«ã‚’é–‹å§‹ã—ãŸã‚‰
// #header-txtを固定
if ($('#header-txt').length) {
$('#header-txt').css({
'top': '0',
'position': 'fixed',
'zIndex' : '3'
});
}
//all_includeã«ãƒžãƒ¼ã‚¸ãƒ³ã‚’ã¤ã‘ã‚‹
if ($('#main_image + .all_include').length) {
$('#main_image + .all_include').css({
'marginTop': headerTxtHeight + 'px',
});
}
// メインビジュアルã«topを付与
if ($('#header-txt').length && $('#main_image').length) {
$('#main_image').css('top', headerTxtHeight);
}
// #header-txt + #main_image ã®é«˜ã•分スクãƒãƒ¼ãƒ«ã—ãŸã‚‰
if ( $(window).scrollTop() >= headerTxtHeight + mainImageHeight ) {
// #headerã«topを付与ã—ã¦å›ºå®š
if ($('#header-txt').length) {
$('#header').css({
'position': 'fixed',
'top': headerTxtHeight + 'px'
});
}
// #header-txt + #main_image ã®é«˜ã•よりå°ã•ããªã£ãŸã‚‰
}else if( $(window).scrollTop() < headerTxtHeight + mainImageHeight ) {
// #headerã®topã‚’0ã«ã—ã¦relative
if ($('#header-txt').length) {
$('#header').css({
'position': 'relative',
'top': headerTxtHeight + 'px'
});
}
$('main').css({
'top': headerTxtHeight + 'px'
});
}
});
}
//■■■■スムーズアンカー â– â– â– â–
// #ã§å§‹ã¾ã‚‹ã‚¢ãƒ³ã‚«ãƒ¼ã‚’クリックã—ãŸå ´åˆã«å‡¦ç†
$('a[href^="\\#"]').on("click", function()
{ if($(this).hasClass("no-scroll"))
{ return;
}
// スクãƒãƒ¼ãƒ«ã®é€Ÿåº¦
var speed = 500; // ミリ秒
// アンカーã®å€¤å–å¾—
var href= $(this).attr("href");
// 移動先をå–å¾—
var target = $(href == "#" || href == "" ? 'html' : href);
// 移動先を数値ã§å–å¾—
var position = target.offset().top;
// スムーススクãƒãƒ¼ãƒ«
$('body,html').animate({scrollTop:position}, speed, 'swing');
return false;
});
//■■■■ページトップ â– â– â– â–
var pagetop = $('#page-top');
pagetop.hide();
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
pagetop.fadeIn();
// if( ($('body').height() - $('footer').height() - $(this).height() - 90 ) < $(this).scrollTop() ){
if( ($('body').height() - $('footer').height() - $(this).height() - 36 ) < $(this).scrollTop() ){
pagetop.css("bottom","52px");
// pagetop.css("bottom", ( $(this).scrollTop() - $('body').height() + $('footer').height() + $(this).height() + 90 ) + "px");
}else{
pagetop.css("bottom","20px");
}
} else {
pagetop.fadeOut();
}
});
//■■■■スマホ メニューOPEN â– â– â– â–
$(".icon_headermenu, #header_links, .page_bottom_links .open_menu").on("click", function() {
$("#header_links").slideToggle(300);
});
$("#header_links a").on("click",function(e){
e.stopPropagation();
});
//■■■■スマホフッターã®ãƒ¡ãƒ‹ãƒ¥ãƒ¼OPEN â– â– â– â–
$("footer nav h3").on("click", function() {
if( $(window).width() < 784 ){
$(this).next('div').slideToggle(300);
if( $(this).hasClass('on') ) $(this).removeClass('on');
else $(this).addClass('on');
}
});
//â– â– â– â– Windowã‚µã‚¤ã‚ºåˆ‡æ› â– â– â– â–
$(window).resize(function(){
if( $(this).width() >= 784 ){
$("#header_links").css("display","block");
$(".folder_links p").css("display","table-row");
}else{
$("#header_links").css("display","none");
$(".folder_links p").css("display","none");
}
});
//â– â– â– â– folder_links â– â– â– â–
aTEXT = "";
$(".folder_links a").each(function(){
if( $(this).prop("href") ){
url = $(this).prop("href");
if( location.href == url ) $(this).addClass("on");
}
});
$(".folder_links").each(function(){
$(this).find("a").each(function(i){
if( $(this).hasClass("on"))
aTEXT = $(this).text();
});
if( aTEXT != ""){
$(this).find("h3").text(aTEXT);
}
});
$(".folder_links h3").on("click", function(){
$(this).parent().find("p").slideToggle(300);
});
$(".folder_links a").on('click', function(){
if( !$('this').hasClass('on') ){
$(".folder_links a").removeClass('on');
$(this).addClass('on');
if( $(window).width() < 784 ){
$(this).parent().parent().find('h3').text( $(this).text() );
$(this).parent().slideToggle(300);
}
}
});
//â– â– â– â– .banner_slides 切りæ›ãˆã‚»ãƒƒãƒˆ â– â– â– â–
bannerID = new Array();
$(".banner_slides").each(function(i){
bannerCount[i] = $(this).find("li").length;
bannerNow[i] = 0;
bannerHTML[i] = $(this).find("ul").html();
$ele = $(this);
setBanner(i);
if($(window).width < 800){
$ele.find("ul").html( bannerHTML[i] + bannerHTML[i] );
$ele.find("li").css("width", ( 50 / bannerCount[i] ) + "%");
}
$(window).resize(function(){
setBanner(i);
if($(window).width < 800){
$ele.find("ul").html( bannerHTML[i] + bannerHTML[i] );
$ele.find("li").css("width", ( 50 / bannerCount[i] ) + "%");
setBanner(i);
}else{
$ele.find("ul").html( bannerHTML[i] );
$ele.find("li").css("width", "33.3333%");
}
});
for( j=0; j " );
}
$(this).find(".icons a").eq(0).addClass("on");
$(this).find(".next").on("click",function(){
bannerNext(i);
});
$(this).find(".prev").on("click",function(){
bannerPrev(i);
});
});
$(window).resize(function(){
$(".banner_slides").each(function(i){
setBanner(i);
});
});
//ヘッダータブアクティブ化
$("#wedding_site_tab").find('a').eq(0).addClass('on');
//â– â– â– â– .popup-banner â– â– â– â–
$('.popup-banner .close, .popup-banner').on('click', function(){
$('.popup-banner').fadeOut(300);
});
$('.popup-banner > figure').on('click', function(e){
e.stopPropagation();
});
});
//â– â– â– â– .banner_slides 切りæ›ãˆé–¢æ•° â– â– â– â–
bannerCount = new Array();
bannerNow = new Array();
bannerHTML = new Array();
function setBanner(NUM){
clearTimeout(bannerID[NUM]);
if($(window).width() >= 800){
bannerWidth = 33.3333;
$(".banner_slides").eq(NUM).find(".icons, .next, .prev").hide();
$(".banner_slides").eq(NUM).find("ul").css({
width: "auto",
marginLeft: "0"
});
$(".banner_slides").eq(NUM).find("li").css({
width: "33.3333%"
});
}else{
bannerWidth = 100;
if( bannerCount[NUM] > 1 ){
$(".banner_slides").eq(NUM).find(".icons, .next, .prev").show();
}else{
$(".banner_slides").eq(NUM).find(".icons, .next, .prev").hide();
}
$(".banner_slides").eq(NUM).find("ul").css({
width: ( bannerWidth * bannerCount[NUM] * 2 ) + "%",
marginLeft: - ( bannerWidth * bannerNow[NUM] * 2 ) + "%"
});
$(".banner_slides").eq(NUM).find("li").css({
width: ( 50 / bannerCount[NUM] ) + "%"
});
bannerID[NUM] = setTimeout("bannerNext(" + NUM + ")", 5000);
}
}
function bannerSlide(ele,NUM){
clearTimeout(bannerID[ele]);
bannerNow[ele] = NUM;
$(".banner_slides").eq(ele).find("ul").animate({ marginLeft: - ( bannerWidth * NUM ) + "%" }, 500);
$(".banner_slides").eq(ele).find(".icons a").removeClass("on");
$(".banner_slides").eq(ele).find(".icons a").eq(NUM).addClass("on");
bannerID[ele] = setTimeout("bannerNext(" + ele + ")", 5000);
}
function bannerNext(ele){
if($(window).width() < 800){
if( bannerNow[ele] >= bannerCount[ele] - 1 ){
bannerSlide(ele,0);
}else{
bannerSlide(ele,bannerNow[ele]+1);
}
}
}
function bannerPrev(ele){
if( bannerNow[ele] <= 0 ){
bannerSlide(ele,bannerCount[ele] - 1);
}else{
bannerSlide(ele,bannerNow[ele]-1);
}
}
// *******************************************************
//   Link On
// *******************************************************
DomainURL = "http://chillma.jp/";
function link_on(ID,FolderFlag){
menu_list = document.getElementById(ID).getElementsByTagName("a");
for(i=0; i
if( FolderFlag ){
if( location.href == DomainURL && menu_list[i].href == DomainURL ){
menu_list[i].className = "on";
}else if( location.href.indexOf(menu_list[i].href) != -1 && menu_list[i].href != DomainURL ){
menu_list[i].className = "on";
}
}else{
var location_url = location.href.match("(.+?)([\?#;].*)?$")[1];
if( location_url == menu_list[i].href ){
menu_list[i].className = "on";
if(ID == "header_links"){
menu_list[i].parentNode.style.display = "block";
}
// if(menu_list[i].parentNode.parentNode.getElementsByTagName("a")[0] && menu_list[i].href != "" ){
// menu_list[i].parentNode.parentNode.getElementsByTagName("a")[0].className = "on";
// }
}
}
}
}
// â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â–
//   汎用ãƒãƒƒãƒ—アップ
// â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â–
function w_open( URL , winX , winY ){
window.open( URL ,"_blank","width=" + winX + ",height=" + winY + ",location=no,menubar=no,scrollbars=yes,status=no,toolbar=no");
}
// â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â–
//   InstagramBtn
// â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â– â–
document.addEventListener('DOMContentLoaded', function () {
function checkBreakPoint() {
var width = window.innerWidth;
const instagramBtn = document.getElementById('fixed_instagram');
let elmTop = document.getElementById('main_image');
if (width < 890) {
// SPå‘ã‘
if(document.getElementById('header-txt')){
var htH = document.getElementById('header-txt').clientHeight;
}else{
var htH = 0;
};
if( document.getElementById('main_image') ){
if( elmTop.classList.contains('top') == true ){
var miH = 0;
}else{
var miH = document.getElementById('main_image').clientHeight;
}
}else{
var miH = 0;
};
if( document.getElementById('header') ){
var hdH = document.getElementById('header').clientHeight;
}else{
var hdH = 0;
};
let totalH = htH + miH + hdH;
let spIconPosition = totalH + 10;
instagramBtn.style.top = spIconPosition + 'px';
} else {
// PCå‘ã‘
if(document.getElementById('header-txt')){
if( elmTop.classList.contains('top') == true ){
var htH = document.getElementById('header-txt').clientHeight;
}else{
var htH = 0;
}
}else{
var htH = 0;
};
if( document.getElementById('main_image') ){
if( elmTop.classList.contains('top') == true ){
var miH = 0;
}else{
var miH = document.getElementById('main_image').clientHeight;
}
}else{
var miH = 0;
};
if( document.getElementById('header') ){
if( elmTop.classList.contains('top') == true ){
var hdH = document.getElementById('header').clientHeight;
}else{
var hdH = 0;
}
}else{
var hdH = 0;
};
let totalH = htH + miH + hdH;
let spIconPosition = totalH + 30;
instagramBtn.style.top = spIconPosition + 'px';
console.log(spIconPosition);
}
}
// リサイズã®ç›£è¦–
window.addEventListener('resize', checkBreakPoint);
// åˆå›žãƒã‚§ãƒƒã‚¯
checkBreakPoint();
});