var isIE9 = window.navigator.userAgent.toLowerCase().indexOf("msie") != -1 && window.navigator.appVersion.toLowerCase().indexOf("msie 9.") != -1; $(function(){ function hdgAreaSize() { ww = $(window).width(); wh = $(window).height(); $('.hdg-top').css('height', wh - $('header').height()); if (ww > 768) { if ((wh - $('header').height()) / ww < 0.56222548) { $('.hdg-top-anim').addClass('wide'); } else { $('.hdg-top-anim').removeClass('wide'); } } else { if ((wh - $('header').height()) / ww < 1.78956) { $('.hdg-top-anim').addClass('wide'); } else { $('.hdg-top-anim').removeClass('wide'); } } } hdgAreaSize(); $(window).on('resize',function(){ hdgAreaSize(); }); (function hdgScroll() { $('.hdg-top .scroll').on('click',function(){ var position = $('.main').offset().top; $("html,body").animate({ scrollTop : position }, { queue : false }); }); })(); (function scrollAnim() { var $target = $('.js-fadein'); if($target.get(0)) { var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $it.offset().top) { $it.addClass('js-animated'); $it.addClass('fadeIn animated'); if(isIE9) {$it.addClass('op1');} if($it.hasClass('js-fadein-left')) { $it.addClass('fadeInLeft'); $it.removeClass('fadeIn'); if(isIE9) {$it.addClass('op1');} } else if ($it.hasClass('js-customfadein')) { $it.addClass('customFadeInUp'); $it.removeClass('fadeIn'); if(isIE9) {$it.addClass('op1');} } else if ($it.hasClass('js-bouncein')) { $it.addClass('bounceIn'); $it.removeClass('fadeIn'); if(isIE9) {$it.addClass('op1');} } } }); }; $(window).on('scroll', anim); anim(); } })(); (function scrollAnimUp() { var $target = $('.js-fadeinup'); if($target.get(0)) { var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $it.offset().top) { $it.addClass('js-animated'); $it.addClass('fadeInUp animated'); if(isIE9) {$it.addClass('op1');} } }); }; $(window).on('scroll', anim); anim(); } })(); (function scrollAnimBnr() { var $target = $('.js-anim-bnr'); if($target.get(0)) { var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.8 > $it.offset().top) { $it.addClass('js-animated'); $it.addClass('bnr-fadeIn'); if(isIE9) {$it.addClass('op1');} } }); }; $(window).on('scroll', anim); anim(); } })(); (function scrollAnimButtom() { var $target = $('.js-anim-buttom'); if($target.get(0)) { var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.9 > $it.offset().top) { $it.addClass('js-animated'); $it.addClass('fadeIn animated'); if(isIE9) {$it.addClass('op1');} } }); }; $(window).on('scroll', anim); anim(); } })(); (function navMenu() { $('.menu-trigger').on('click',function(){ var $target = $(this); $target.toggleClass('active'); $target.parent('.nav').toggleClass('open'); if(!$target.next('.menu-wrap').hasClass('show')) { setTimeout(function(){ $target.next('.menu-wrap').addClass('show'); },200); } else { $target.next('.menu-wrap').removeClass('show'); } }); })(); (function replaceGifanime() { if($('.container').hasClass('mechanic')) { if($('.container').hasClass('zh')) { $('.kaizen').find('.kaizen-main__img img').each(function(){ if($(this).closest('.kaizen').hasClass('is-03')) { $(this).attr('src', '../images/gif/kaizen_' + $(this).closest('.kaizen').attr('class').split(' ')[1].split('-')[1] + '.gif'); } else { $(this).attr('src', '../images/gif/kaizen_' + $(this).closest('.kaizen').attr('class').split(' ')[1].split('-')[1] + '_zh.gif'); } }); } else if($('.container').hasClass('en')) { $('.kaizen').find('.kaizen-main__img img').each(function(){ if($(this).closest('.kaizen').hasClass('is-03')) { $(this).attr('src', 'images/gif/kaizen_' + $(this).closest('.kaizen').attr('class').split(' ')[1].split('-')[1] + '.gif'); } else { $(this).attr('src', 'images/gif/kaizen_' + $(this).closest('.kaizen').attr('class').split(' ')[1].split('-')[1] + '_en.gif'); } }); } else { $('.kaizen').find('.kaizen-main__img img').each(function(){ $(this).attr('src', '/~/media/cojp/product/ism/sp/dff/images/gif/kaizen_' + $(this).closest('.kaizen').attr('class').split(' ')[1].split('-')[1] + '.gif'); }); } } })(); (function listHeight() { function listSize(){ var array = []; var counter = 0; $('.line-up-item__list').each(function(){ $(this).css('height', ''); array[counter] = $(this).height(); counter++; }); if(Math.max.apply(Math, array) > 212) { $('.line-up-item__list').each(function(){ $(this).css('height', Math.max.apply(Math, array)); }); } else { $('.line-up-item__list').each(function(){ $(this).css('height', ''); }); } } listSize(); $(window).on('resize',function(){ listSize(); }); })(); (function OwnerHtmlReplace() { function htmlReplace(){ if($('.container').hasClass('owner') && ww < 769) { $('.kaizen').each(function(){ $(this).find('.kaizen-main__img').insertBefore($(this).find('.kaizen-main__paragraph')); }); } else if($('.container').hasClass('owner') && ww > 768) { $('.kaizen').each(function(){ $(this).find('.kaizen-main__img').insertAfter($(this).find('.kaizen-main')); }); } } htmlReplace(); //ブレークポイントをまたいだ時にだけ処理をする var trigger = false; var past = trigger; $(window).on('load resize',function(){ if(ww > 768) { trigger = false; }else { trigger = true; } }); setInterval(function(){ if(past !== trigger) { htmlReplace(); } past = trigger; },100); })(); (function cvMove () { $(window).on('scroll', function() { if ($(window).scrollTop() > $('.main').offset().top) { $('.floating-bnr').css({ top: '40px', 'margin-top': '0' }); } else { $('.floating-bnr').attr('style',''); } }); })(); //インデックスのトップのアニメーションのHTMLタグ作成 (function indexAnimHtml() { if($('.container').hasClass('index')) { for (var i = 1; i < 10; i++) { $('').appendTo('.wrap-animimg'); } } })(); (function scrollArrowAnim() { setInterval(function(){ $('.scroll').find('.arrow').addClass('down'); setTimeout(function(){ $('.scroll').find('.arrow').removeClass('down'); },300); },1000); })(); (function pageTop() { $('.btn-pagetop').on('click',function(){ $('body,html').animate({ scrollTop: 0 }, 500); }); })(); (function Popup() { $('.popup-youtube').magnificPopup({ type: 'iframe', preloader: false }); })(); (function graphAnim() { if($('.container').hasClass('mechanic')) { graph_array = [ function(){ var ctx = document.getElementById("chart1").getContext('2d'); var chart1 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], hoverBackgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], data: [94, 6], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false }, responsive: false , animation: { duration: 2000, }, } }); }, function(){ var ctx = document.getElementById("chart2").getContext('2d'); var chart2 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], hoverBackgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], data: [93, 7], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false }, responsive: false, animation: { duration: 2000, }, } }); }, function(){ var ctx = document.getElementById("chart3").getContext('2d'); var chart3 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], hoverBackgroundColor: [ "#5abee7", "rgba(0, 0, 0, 0)" ], data: [90, 10], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false }, responsive: false, animation: { duration: 2000, }, } }); } ]; var ctx = document.getElementById("chartBg1").getContext('2d'); var chartBg1 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "rgba(0, 0, 0, 0.5)", "rgba(0, 0, 0, 0.5)" ], hoverBackgroundColor: [ "#2ecc71", "#3498db" ], data: [100, 0], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false, }, animation: { duration: 0, }, responsive: false } }); var ctx = document.getElementById("chartBg2").getContext('2d'); var chart2 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "rgba(0, 0, 0, 0.5)", "rgba(0, 0, 0, 0.5)" ], hoverBackgroundColor: [ "#2ecc71", "#3498db" ], data: [100, 0], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false, }, animation: { duration: 0, }, responsive: false } }); var ctx = document.getElementById("chartBg3").getContext('2d'); var chart3 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "rgba(0, 0, 0, 0.5)", "rgba(0, 0, 0, 0.5)" ], hoverBackgroundColor: [ "#2ecc71", "#3498db" ], data: [100, 0], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 40, tooltips: { enabled: false }, legend: { display: false, }, animation: { duration: 0, }, responsive: false } }); } })(); var countup = function($target, numLength, speed, delay) { var $num = $target.find('.js-countup-num'); var arrayNum = (function() { var tmp = []; var ret = []; for(var i=0; i 10 && numLength < 100) { tmp.forEach(function(v) { if(10 > v) {ret.push('0' + v)} else {ret.push(v.toString());} }); } else if(numLength > 100) { tmp.forEach(function(v) { if(10 > v) {ret.push('00' + v)} else if(100 > v && 10 < v) {ret.push('0' + v)} else {ret.push(v.toString());} }); } else { tmp.forEach(function(v) { ret.push(v.toString()); }); } return ret; })(); var countup = (function() { var index = 0; return function count() { $num.text(arrayNum[index]); index++; if(arrayNum.length > index) {setTimeout(count, speed);} } })(); setTimeout(countup, delay); }; (function kaizenAnim() { if($('.container').hasClass('mechanic')) { var $target = $('.kaizen'); var countup_array = [94,93,90]; if($target.get(0)) { $target.each(function(){ $(this).find('.js-countup-num').text('00'); }); var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.5 > $it.offset().top) { $it.addClass('js-animated'); setTimeout(function(){ $it.find('.graph').addClass('fadeInUp animated'); if(isIE9) {$it.find('.graph').addClass('op1');} },500); setTimeout(function(){ var kaizen_num = $it.attr('class').split(' ')[1].split('0')[1] - 1; graph_array[kaizen_num](); countup($it, countup_array[kaizen_num], 10, 100); },1500); setTimeout(function(){ $it.find('.kaizen-graph__txt').addClass('fadeInUp animated'); if(isIE9) {$it.find('.kaizen-graph__txt').addClass('op1');} },2800); } }); }; $(window).on('scroll', anim); anim(); } } if($('.container').hasClass('owner')) { var $target = $('.kaizen'); if($target.get(0)) { var anim = function() { $target.each(function(){ var $it = $(this); if(!$it.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.5 > $it.offset().top) { $it.addClass('js-animated'); $it.find('.kaizen-main__hdg, .kaizen-main__paragraph').addClass('fadeIn animated'); if(isIE9) {$it.find('.kaizen-main__hdg, .kaizen-main__paragraph').addClass('op1');} // setTimeout(function(){$it.find('.kaizen-main__paragraph').addClass('fadeIn animated');},300); setTimeout(function(){ $it.find('.kaizen-main__img').addClass('fadeIn animated'); if(isIE9) {$it.find('.kaizen-main__img').addClass('op1');} },500); setTimeout(function(){ if($it.find('.kaizen-main__img').hasClass('js-kaizen1-anim')) { $it.find('.bar1').addClass('kaizen1Anim1 animated'); $it.find('.bar2').addClass('kaizen1Anim2 animated'); if(isIE9) { $it.find('.bar1').css('height','176'); $it.find('.bar2').css('height','74'); } setTimeout(function(){ $it.find('.badge').addClass('bounceIn animated'); if(isIE9) {$it.find('.badge').addClass('op1');} },1600); } else if($it.find('.kaizen-main__img').hasClass('js-kaizen2-anim')) { setTimeout(function(){ $it.find('.sub').addClass('bounceIn animated'); if(isIE9) {$it.find('.sub').addClass('op1');} },100); setTimeout(function(){ $it.find('.badge').addClass('bounceIn animated'); if(isIE9) {$it.find('.badge').addClass('op1');} },800); } else if($it.find('.kaizen-main__img').hasClass('js-kaizen3-anim')) { $it.find('.bar1').addClass('kaizen3Anim1 animated'); $it.find('.bar2').addClass('kaizen3Anim2 animated'); if(isIE9) { $it.find('.bar1').css('height','137'); $it.find('.bar2').css('height','161'); } setTimeout(function(){ $it.find('.badge').addClass('bounceIn animated'); if(isIE9) {$it.find('.badge').addClass('op1');} },1600); } },1200); } }); }; $(window).on('scroll', anim); anim(); } if(ww > 768) { } } })(); (function closeMenu() { $(document).on('click',function(e){ if((e.target).closest('.nav') == null) { $('.nav').removeClass('open'); $('.menu-trigger').removeClass('active'); } }); })(); (function ownerTrouble03Anim() { trouble3Graph = function(){ var ctx = document.getElementById("owner-trouble-03-graph").getContext('2d'); var chart1 = new Chart(ctx, { type: 'doughnut', data: { labels: [], datasets: [{ backgroundColor: [ "#0060a8", "#6ccef4" ], hoverBackgroundColor: [ "#0060a8", "#6ccef4" ], data: [70, 30], borderWidth: [0,0] }], }, options: { title: { display: false, }, cutoutPercentage: 30, tooltips: { enabled: false }, legend: { display: false }, responsive: false , animation: { duration: 1500, }, } }); } })(); (function ownerTrouble1Anim() { var $target = $('.js-trouble1-anim'); if($target.get(0)) { var anim = function() { if(!$target.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $target.offset().top) { $target.addClass('js-animated'); setTimeout(function(){ $target.find('.badge').addClass('bounceIn animated'); if(isIE9) {$target.find('.badge').addClass('op1');} },500); } }; $(window).on('scroll', anim); anim(); } })(); (function ownerTrouble2Anim() { var $target = $('.js-trouble2-anim'); if($target.get(0)) { var anim = function() { if(!$target.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $target.offset().top) { $target.addClass('js-animated'); setTimeout(function(){ $target.find('.sub.is-01').addClass('bounceIn animated'); if(isIE9) {$target.find('.sub.is-01').addClass('op1');} },500); setTimeout(function(){ $target.find('.sub.is-02').addClass('bounceIn animated'); if(isIE9) {$target.find('.sub.is-02').addClass('op1');} },700); } }; $(window).on('scroll', anim); anim(); } })(); (function ownerTrouble3Anim() { var $target = $('.js-trouble3-anim'); if($target.get(0)) { var anim = function() { if(!$target.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $target.offset().top) { $target.addClass('js-animated'); setTimeout(function(){trouble3Graph();},100); setTimeout(function(){ $target.find('.num.is-70').addClass('bounceIn animated'); if(isIE9) {$target.find('.num.is-70').addClass('op1');} },900); setTimeout(function(){ $target.find('.num.is-30').addClass('bounceIn animated'); if(isIE9) {$target.find('.num.is-30').addClass('op1');} },1200); } }; $(window).on('scroll', anim); anim(); } })(); (function ownerTrouble3Anim() { var $target = $('.js-trouble3-anim'); if($target.get(0)) { var anim = function() { if(!$target.hasClass('js-animated') && $(window).scrollTop() + $(window).height() * 0.7 > $target.offset().top) { $target.addClass('js-animated'); $target.find('.label').addClass('fadeInUp animated'); if(isIE9) {$it.find('.label').addClass('op1');} setTimeout(function(){trouble3Graph();},200); setTimeout(function(){ $target.find('.num.is-70').addClass('bounceIn animated'); if(isIE9) {$target.find('.num.is-70').addClass('op1');} },1000); setTimeout(function(){ $target.find('.num.is-30').addClass('bounceIn animated'); if(isIE9) {$target.find('.num.is-30').addClass('op1');} },1300); } }; $(window).on('scroll', anim); anim(); } })(); // (function spNavWidth() { // var sp_nav = function(){ // if(ww < 769) { // $('.nav').find('ul').css({ // width: $('.nav').find('ul').width(), // left: '50%' // }); // } else { // $('.nav').find('ul').attr('style',''); // } // }; // sp_nav(); // $(window).on('resize',function(){ // sp_nav(); // }); // })(); (function menuFixed() { var check = false; //ハンバーガーメニューの開閉チェック var current_scrollY; $('.menu-trigger').click(function () { if ($('.nav').hasClass('open')) { current_scrollY = $(document).scrollTop(); $('body,html').css( { position: 'fixed', width: '100%', top: -current_scrollY }) } else { $('body,html').attr({style: ''}); $('body,html').prop({scrollTop: current_scrollY}); } }); })(); //画像をすべて読みこんでから処理実行 $('.container').imagesLoaded( function() { (function hdgAnim() { if($('.container').hasClass('index') && ww > 768) { $('.hdg-top').addClass('fadeIn animated'); if(isIE9) {$('.hdg-top').addClass('op1');} var counter = 0; var loop = false; setInterval(function(){ //12フレーム目で見出しの白い丸を表示 if(loop == false && counter == 4) { $('.hdg-top-circle').addClass('show'); setTimeout(function(){ $('.hdg-top-circle__fukidashi').addClass('bounceIn animated'); if(isIE9) {$('.hdg-top-circle__fukidashi').addClass('op1');} setTimeout(function(){ $('.hdg-top-circle__main').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top-circle__main').addClass('op1');} setTimeout(function(){ $('.hdg-top-circle__paragraph').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top-circle__paragraph').addClass('op1');} },400); },200); },200); } //$('.hdg-top-anim img.anim').attr('src','/images/img_top_' + counter + '.png'); $('.wrap-animimg').find('.visible').each(function(){ $(this).removeClass('visible'); }); $('.wrap-animimg').find('.is-' + counter).addClass('visible'); counter++; if(counter > 9) { counter = 0; if(loop == false) { loop = true; } } },150); } else if($('.container').hasClass('index') && ww < 769) { $('.hdg-top').addClass('fadeIn animated'); setTimeout(function(){$('.hdg-top-circle').addClass('show');},1000); setTimeout(function(){ $('.hdg-top-circle__fukidashi').addClass('bounceIn animated'); if(isIE9) {$('.hdg-top-circle__fukidashi').addClass('op1');} },1200); setTimeout(function(){ $('.hdg-top-circle__main').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top-circle__main').addClass('op1');} },1400); setTimeout(function(){ $('.hdg-top-circle__paragraph').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top-circle__paragraph').addClass('op1');} },1600); } })(); //下層のページの見出しアニメーション (function hdgAnim2() { if(!$('.container').hasClass('index')) { $('.hdg-top__hdg').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top__hdg').addClass('op1');} setTimeout(function(){ $('.hdg-top__main').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top__main').addClass('op1');} setTimeout(function(){ $('.hdg-top__paragraph').addClass('fadeInUp animated'); if(isIE9) {$('.hdg-top__paragraph').addClass('op1');} },400); },400); } })(); }); (function menuPos() { var menu_pos = function(){ if($('.menu-trigger').hasClass('active')) { if(ww > 768) { $('.menu-trigger').css('top', '40px'); } else { $('.menu-trigger').css('top', '20px'); } } else { if(ww > 768) { $('.menu-trigger').css('top', $('.container').offset().top + 40); if($(window).scrollTop() > $('header').height()) { $('.menu-trigger').css('top', '40px'); } } else { $('.menu-trigger').css('top', $('.container').offset().top + 20); if($(window).scrollTop() > $('header').height()) { $('.menu-trigger').css('top', '20px'); } } } }; menu_pos(); $(window).on('resize scroll',function(){ menu_pos(); }); })(); });