/* readyEvent ------------------------------------------------------------------------*/ document.addEventListener("DOMContentLoaded", function(e) { // $('.js-slider-rom').slick({ autoplay: true, autoplaySpeed: 3000, speed: 800, arrows: true, dots: false, prevArrow: '
', nextArrow: '
' }); //スライダー1 $('.slider_num').slick({ arrows: false, autoplay: true, autoplaySpeed:5000, dots:true, }); //スライダー $('.slider_arrow').slick({ arrows: false,//※手動で設定 autoplay:true, autoplaySpeed:5000, dots:true, }); //タブ切り替え1 var $tab = $('#tab'), $li = $tab.find('li'); $li.click(function(){ var target = $(this).attr('data-target'); if($(target).is(':hidden')) { $(target).fadeIn(300).siblings().hide(); $(this).addClass('active').siblings().removeClass('active'); } }); }); var slider_basic = { // ← 「slider_basic」は好きな名前にしてください // ↓オプションの内容はお好きなように arrows: false,//※手動で設定 autoplay:true, autoplaySpeed:5000, dots:true, slidesToShow: 3, //centerMode: true, responsive: [{ breakpoint: 768, settings: { slidesToShow: 1, } }] } //.js_slider var sliderTarget = '.js_slider', btn_prev = '.btn_prev', btn_next = '.btn_next'; // スライダー:実行命令 function slider(sliderBox, sliderOption) { var sliderBox = (typeof sliderBox!== 'undefined') ? sliderBox: ''; var sliderOption = (typeof sliderOption!== 'undefined') ? sliderOption: slider_basic; $(sliderBox).find(sliderTarget).slick(sliderOption); $(btn_prev).on('click',function(){ $(this).parents(sliderBox).find(sliderTarget).slick('slickPrev'); }); $(btn_next).on('click',function(){ $(this).parents(sliderBox).find(sliderTarget).slick('slickNext'); }); } // auto height function matchHeight($o,m) { $o.css('height','auto') var foo_length = $o.length; for(var i = 0 ; i < Math.ceil(foo_length / m) ; i++) { var maxHeight = 0; for(var j = 0; j < m; j++){ if ($o.eq(i * m + j).height() > maxHeight) { maxHeight = $o.eq(i * m + j).height(); } } for(var k = 0; k < m; k++){ $o.eq(i * m + k).height(maxHeight); } } } /** * * matchHeightS * @param $o { jQueryObjects } - 高さを合わせるターゲット * @param $o { m } - 各クエリでの割合 1 で高さを auto 指定 * */ function matchHeightS($o, m) { var _w = Math.floor((100 / m) * 10) / 10; var _parent = $o.parent(); if (m > 1) { $o.css('height', 'auto'); if ($o.css('float') != 'none') { $o.css('width', String(_w) + '%') } else if (_parent.css('display') == 'flex') { $o.css('width', String(_w) + '%'); } var foo_length = $o.length; for(var i = 0 ; i < Math.ceil(foo_length / m) ; i++) { var maxHeight = 0; for(var j = 0; j < m; j++){ if ($o.eq(i * m + j).height() > maxHeight) { maxHeight = $o.eq(i * m + j).height(); } } for(var k = 0; k < m; k++){ $o.eq(i * m + k).height(maxHeight); } } } else { $o.css('height', 'auto'); if ($o.css('float') != 'none') { $o.css('width', String(_w) + '%') } else if (_parent.css('display') == 'flex') { $o.css('width', String(_w) + '%'); } } }