/*============================================== ページ内リンク ==============================================*/ jQuery(function() { jQuery("a[href^=#]").click(function(){ var elmID = jQuery(this).attr("href"); var posi = 0; if(jQuery(elmID).size()){ posi = jQuery(elmID).offset().top -0; BodySlider(posi); return false; } }); function BodySlider(HashOffset){ jQuery("html,body").animate({ scrollTop: HashOffset }, 600); } }); /*============================================== スライドショー ==============================================*/ $(function() { $('.slider').slick({ prevArrow: '', nextArrow: '', infinite: true, dots: false, slidesToShow: 1, centerMode: true, //要素を中央寄せ centerPadding:'15%', //両サイドの見えている部分のサイズ autoplay:true, //自動再生 responsive: [{ breakpoint: 480, settings: { centerMode: true, } }] }); }); /*============================================== accordionbox ==============================================*/ $(function(){ $(".accordionbox dt").on("click", function() { $(this).next().slideToggle(); // activeが存在する場合 if ($(this).children(".accordion_icon").hasClass('active')) { // activeを削除 $(this).children(".accordion_icon").removeClass('active'); } else { // activeを追加 $(this).children(".accordion_icon").addClass('active'); } }); }); /*============================================== slider 画像切替 ==============================================*/ $(function(){ var slider = "#slider"; // スライダー var thumbnailItem = "#thumbnail-list .thumbnail-item"; // サムネイル画像アイテム // サムネイル画像アイテムに data-index でindex番号を付与 $(thumbnailItem).each(function(){ var index = $(thumbnailItem).index(this); $(this).attr("data-index",index); }); // スライダー初期化後、カレントのサムネイル画像にクラス「thumbnail-current」を付ける // 「slickスライダー作成」の前にこの記述は書いてください。 $(slider).on('init',function(slick){ var index = $(".slide-item.slick-slide.slick-current").attr("data-slick-index"); $(thumbnailItem+'[data-index="'+index+'"]').addClass("thumbnail-current"); }); //slickスライダー初期化 $(slider).slick({ autoplay: true, arrows: false, fade: true, infinite: false //これはつけましょう。 }); //サムネイル画像アイテムをクリックしたときにスライダー切り替え $(thumbnailItem).on('click',function(){ var index = $(this).attr("data-index"); $(slider).slick("slickGoTo",index,false); }); //サムネイル画像のカレントを切り替え $(slider).on('beforeChange',function(event,slick, currentSlide,nextSlide){ $(thumbnailItem).each(function(){ $(this).removeClass("thumbnail-current"); }); $(thumbnailItem+'[data-index="'+nextSlide+'"]').addClass("thumbnail-current"); }); }); /*============================================== 要素の高さを揃える ==============================================*/ $(function(){ $('.STF_WEBNAME').matchHeight(); $('.lineup_in').matchHeight(); $('#main .tour02 dd').matchHeight(); $('.sec06 .diary_box dd').matchHeight(); });