// JavaScript Document // Keyvisual Slide $(document).ready(function(){ var $setElm = $('.news-txt'); var cutFigure = '83'; // カットする文字数 var afterTxt = ' …'; // 文字カット後に表示するテキスト $setElm.each(function(){ var textLength = $(this).text().length; var textTrim = $(this).text().substr(0,(cutFigure)) if(cutFigure < textLength) { $(this).html(textTrim + afterTxt).css({visibility:'visible'}); } else if(cutFigure >= textLength) { $(this).css({visibility:'visible'}); } }); var $setElm2 = $('.news-txt2'); var cutFigure2 = '150'; // カットする文字数 var afterTxt2 = ' …'; // 文字カット後に表示するテキスト $setElm2.each(function(){ var textLength2 = $(this).text().length; var textTrim2 = $(this).text().substr(0,(cutFigure2)) if(cutFigure2 < textLength2) { $(this).html(textTrim2 + afterTxt2).css({visibility:'visible'}); } else if(cutFigure2 >= textLength2) { $(this).css({visibility:'visible'}); } }); // slider var initFunc = { keyvisual: function(){ $('#top-keyvisual').closest('div.sp-initialize').css({"height": "auto"}).fadeTo(500, 1, function() { $(this).removeClass('sp-initialize'); }); }, conpo: function(){ $('#conpo-slide').closest('div.sp-initialize').css({"height": "auto"}).fadeTo(500, 1, function() { $(this).removeClass('sp-initialize'); }); } }; function spSetImageCss(){ if ($(window).width() >= 768) return; $('#conpo-slide img.sp-image').css({ 'width': '100%', 'height': 'auto', 'margin-left': '0' }); } var winwd = $(window).width(), wd_half = winwd * 0.6, wd_33p = winwd * 0.33333; if (winwd < 480) { wd_half = winwd * 0.5; $('#top-keyvisual').sliderPro({ width: '100%', autoplayDelay: '8000', fade: true, fadeDuration: '2000', aspectRatio: 0.7288, forceSize: 'none', smallSize: 480, mediumSize: 754, largeSize: 1010, arrows: false, buttons: true, // スライドが複数枚の場合 // buttons: false,// スライドが1枚の場合 autoplayOnHover: 'none', slideDistance: 0, loop: false, init: initFunc['keyvisual']() , gotoSlideComplete: function(event){ $("#top-keyvisual div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('#conpo-slide').sliderPro({ width: '100%', height: wd_half + 220, forceSize: 'none', arrows: false, buttons: true, autoplayOnHover: 'none', slideDistance: 0, loop: false, init: function(){ initFunc['conpo'](); spSetImageCss(); } , update: spSetImageCss() // , update: spSetImageCss() , gotoSlideComplete: function(event){ $("#conpo-slide div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('.sp-slide .table100').css('height', '220px'); $('.sp-slide .col-md-5').css('height', '220px'); $('.sp-slide .col-md-7').css('height', wd_half+'px'); } else if (winwd < 768) { $('#top-keyvisual').sliderPro({ width: '100%', autoplayDelay: '8000', fade: true, fadeDuration: '2000', aspectRatio: 2.2857, forceSize: 'none', smallSize: 480, mediumSize: 754, largeSize: 1010, arrows: false, buttons: true, // スライドが複数枚の場合 // buttons: false,// スライドが1枚の場合 autoplayOnHover: 'none', slideDistance: 0, loop: false, init: initFunc['keyvisual']() , gotoSlideComplete: function(event){ $("#top-keyvisual div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('#conpo-slide').sliderPro({ width: '100%', height: wd_half + 220, forceSize: 'none', arrows: false, buttons: true, autoplayOnHover: 'none', slideDistance: 0, loop: false, init: function(){ initFunc['conpo'](); spSetImageCss(); } , update: spSetImageCss() // , update: spSetImageCss() , gotoSlideComplete: function(event){ $("#conpo-slide div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('.sp-slide .table100').css('height', '220px'); $('.sp-slide .col-md-5').css('height', '220px'); $('.sp-slide .col-md-7').css('height', wd_half+'px'); } else if (winwd < 800) { $('#top-keyvisual').sliderPro({ width: '100%', autoplayDelay: '8000', fade: true, fadeDuration: '2000', aspectRatio: 0.8992, forceSize: 'none', smallSize: 480, mediumSize: 754, largeSize: 1010, arrows: true, //スライドが複数枚の場合 // arrows: false, //スライドが1枚の場合 buttons: true, //スライドが複数枚の場合 // buttons: false, //スライドが1枚の場合 autoplayOnHover: 'none', slideDistance: 0, loop: false, init: initFunc['keyvisual']() , gotoSlideComplete: function(event){ $("#top-keyvisual div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('#conpo-slide').sliderPro({ width: '100%', aspectRatio: 2, forceSize: 'none', arrows: true, buttons: true, autoplayOnHover: 'none', slideDistance: 0, loop: false, init: initFunc['conpo']() , gotoSlideComplete: function(event){ $("#conpo-slide div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); } }); $('.sp-slide .table100').css('height', wd_half + 'px'); $('.sp-slide .col-md-5').css('height', wd_half + 'px'); $('.sp-slide .col-md-7').css('height', wd_half + 'px'); } else { $('#top-keyvisual').sliderPro({ width: '100%', autoplayDelay: '8000', fade: true, fadeDuration: '2000', aspectRatio: 2.2857, forceSize: 'none', smallSize: 480, mediumSize: 754, largeSize: 799, arrows: true, //スライドが複数枚の場合 // arrows: false, //スライドが1枚の場合 buttons: true, //スライドが複数枚の場合 // buttons: false, //スライドが1枚の場合 autoplayOnHover: 'none', slideDistance: 0, touchSwipe: false, init: initFunc['keyvisual']() }); $('#conpo-slide').sliderPro({ width: '100%', aspectRatio: 3, forceSize: 'none', arrows: true, buttons: true, autoplayOnHover: 'none', slideDistance: 0, touchSwipe: false, init: initFunc['conpo']() }); $('.sp-slide .table100').css('height', wd_33p + 'px'); $('.sp-slide .col-md-5').css('height', wd_33p + 'px'); $('.sp-slide .col-md-7').css('height', wd_33p + 'px'); $('#top-products').css('height', wd_33p + 'px'); $('#top-support').css('height', wd_33p + 'px'); $('#top-products .table100').css('height', wd_33p + 'px'); $('#top-support .table100').css('height', wd_33p + 'px'); $('#top-products .col-md-8').css('height', wd_33p + 'px'); $('#top-support .col-md-8').css('height', wd_33p + 'px'); } $(".sp-buttons").each(function(){ if( $(this).closest('div.slider-pro').find("div.sp-button-pause").length > 0 ) return; var $pause = $('
'); $pause.on("click", function(){ if( $(this).hasClass("active") ){ $(this).removeClass('active'); $(this).closest('div.slider-pro').sliderPro( 'autoplay', true ); spSetImageCss(); } else { $(this).addClass('active'); $(this).closest('div.slider-pro').sliderPro( 'autoplay', false ); spSetImageCss(); } return false; }); $(this).append($pause); }); setTimeout(function(){ $("div.sp-arrow").each(function(){ if( $(this).is(":hidden") ){ $(this).fadeIn(200); } }); }, 200); var kijih = $('.news-wrap').height() + 40, kijih80 = $('.news-wrap').height() + 80; if (winwd < 768) { $( '#news-carousel' ).sliderPro({ width: '100%', forceSize: 'none', arrows: false, buttons: false, autoplay: false, slideDistance: 0, startSlide: 0 }); var newsWrapMaxH=0; $( '#news-carousel .news-wrap' ).each(function(){ newsWrapMaxH = Math.max( newsWrapMaxH, $(this).outerHeight() ); }); $( '#news-carousel .news-wrap' ).height( newsWrapMaxH ); kijih = $('.news-wrap').height() + 40; $('#top-news .sp-mask').css('height', kijih + 'px'); } else if (winwd > 1330) { $( '#news-carousel' ).sliderPro({ width: '33.3333%', visibleSize: '100%', forceSize: 'none', arrows: false, buttons: false, autoplay: false, slideDistance: 0, startSlide: 1 }); var newsWrapMaxH=0; $( '#news-carousel .news-wrap' ).each(function(){ newsWrapMaxH = Math.max( newsWrapMaxH, $(this).outerHeight() ); }); $( '#news-carousel .news-wrap' ).height( newsWrapMaxH ); kijih80 = $('.news-wrap').height() + 80; $('#top-news .sp-mask').css('height', kijih80 + 'px'); setTimeout(function(){ kijih80 = $('.news-wrap').height() + 80; $('#top-news .sp-mask').css('height', kijih80 + 'px'); }, 750); } else { $( '#news-carousel' ).sliderPro({ width: '33.3333%', height: '500px', visibleSize: '100%', forceSize: 'none', arrows: false, buttons: false, autoplay: false, slideDistance: 0, startSlide: 1 }); var newsWrapMaxH=0; $( '#news-carousel .news-wrap' ).each(function(){ newsWrapMaxH = Math.max( newsWrapMaxH, $(this).outerHeight() ); }); $( '#news-carousel .news-wrap' ).height( newsWrapMaxH ); } }); $(window).on('resizeSizeTimer', function(){ location.reload(); });