// JavaScript Document // 多棟物件をアコーディオン $(function() { if($("div#tatou_child").length){ $("div#tatou_child").each(function(i){ $(this).children('.secInfoBox').wrapAll('
'); $(this).find('.secInfoBox').wrapAll('
'); $(this).find(".accordion").prepend('
'); }); } $("#tatou_child .accordion_title").on("click", function() { $(this).next().slideToggle(); $(this).toggleClass("open"); }); }); // 多棟物件の写真 $(".secInfoBox .sliderInfo").each( function( index, element ){ // alert((index+1)+"個目は写真が〜?"); if($(this).eq(index).children("p").length){ // alert("あるね"); $(this).bxSlider({ mode: 'fade', auto: false }); }else{ // alert("なかった"); } }); $(window).load(function() { // もろもろのサイズを設定 if (window.matchMedia('screen and (max-width: 750px)').matches) { //スクリーンサイズが750pxより小さい時の処理 var slideWidthSize = 50; }else{ //750px以上のデスクトップでの処理 var slideWidthSize = 180; } $("div.photo_gallery").each(function(i){ // スライダーのサムネにbxsliderの属性を追加する var i = 0; $(this).find(".slider_tm li a").each(function(i) { // alert(i); $(this).attr('data-slide-index', i); i++; }); var tm = $(this).find('.slider_tm'); var slider01 = $(this).find('.bxslider').bxSlider({ // controls: false, // infiniteLoop: false, pagerCustom: tm, onSlideBefore: function($slideElement, oldIndex, newIndex) { slider02.goToSlide(newIndex); } }); var slider02 = $(this).find('.slider_tm').bxSlider({ controls: true, // infiniteLoop: false, pager: false, minSlides: 5, maxSlides: 5, moveSlides: 1, slideWidth: slideWidthSize, slideMargin: 5, onSlideBefore: function($slideElement, oldIndex, newIndex) { tm.find('li').removeClass("active"); $slideElement.addClass("active"); }, onSlideNext: function($slideElement, oldIndex, newIndex) { slider01.goToSlide(newIndex); }, onSlidePrev: function($slideElement, oldIndex, newIndex) { slider01.goToSlide(newIndex); } }); }); });