/* ------------------------------------------- * @constructor ------------------------------------------- */ var u = new EPOS_CARD.Util(); // u インスタンスを作成 /* ------------------------------------------- * @init ------------------------------------------- */ var animeFlag = true; j$(function(){ j$.atterAnimationClass(); j$.atterAnimationClass02(); j$.accordion(); j$.checkListAnimation(); j$.floatingControlHasCookie(); j$.slider(); $(window).on('load', function (){ j$.mainAnimation(); }); }); /* ------------------------------------------- * @plugin ------------------------------------------- */ (function(j$){ var u = new EPOS_CARD.Util(); // u インスタンスを作成 /* * @method mainAnimation */ j$.mainAnimation = function(){ var $elm = j$('.js-mainAnimation'), animationClass = 'is-animation', $checkGif = j$('.js-checkGif'); if($elm.length === 0){ return false; } $elm.each(function(){ $(this).addClass(animationClass); }) setTimeout( function(){ $checkGif.attr('src', '/virtual/img/index_main03.gif'); }, 600) }, /* * @method atterAnimationClass */ j$.atterAnimationClass = function(){ var $elm = j$('.js-Animation'), animationClass = 'is-animation'; if($elm.length === 0){ return false; } var windowHeight = u.$win.height(), adjust = 900 * (windowHeight / 1080); if(!u.isRangeSP()) { adjust = 780 * (windowHeight / 1080); } u.$win.on('scroll' , function(){ $elm.each(function(){ var elemPos = $(this).offset().top + windowHeight - adjust, scroll = u.$win.scrollTop(); if (scroll >= elemPos - windowHeight){ $(this).addClass(animationClass); } }) }) }, /* * @method atterAnimationClass02 */ j$.atterAnimationClass02 = function(){ var $elm = j$('.js-Animation02'), animationClass = 'is-animation'; if($elm.length === 0){ return false; } var windowHeight = u.$win.height(), adjust = 600 * (windowHeight / 1080); if(!u.isRangeSP()) { adjust = 650 * (windowHeight / 1080); } u.$win.on('scroll' , function(){ $elm.each(function(){ var elemPos = $(this).offset().top + windowHeight - adjust, scroll = u.$win.scrollTop(); if (scroll >= elemPos - windowHeight){ $(this).addClass(animationClass); } }) }) }, /* * @method checkListAnimation */ j$.checkListAnimation = function(){ var $elm = j$('.js-checkList'), $item = j$('.js-checkListItem'), animationClass = 'is-animation'; var windowHeight = u.$win.height(), adjust = 880 * (windowHeight / 1080); if(!u.isRangeSP()) { adjust = 800 * (windowHeight / 1080); } if($elm.length === 0){ return false; } u.$win.on('scroll' , function(){ var elemPos = $elm.offset().top + windowHeight - adjust, scroll = u.$win.scrollTop(); if (scroll >= elemPos - windowHeight){ $item.each(function(i){ $(this).delay(1000*(i++)).queue(function(){ $(this).addClass(animationClass); }); }) } }) }, /* * @method accordion */ j$.accordion = function(config){ var c = j$.extend({ elm: ".jd-vcAccordion", trigger: ".js-vcAccordionTrigger", target: ".js-vcAccordionPanel", speed: 300, openNm: "is-open" },config); // vars var $elm = j$(c.elm), $trg = j$(c.trigger); if($elm.length === 0){ return false; } // setting j$(c.target).not("." + c.openNm).hide(); // trigger $trg.on("click",function(){ var self = j$(this), $wrap = self.parents(c.elm), $target = $wrap.find(c.target); if(self.hasClass(c.openNm)){ self.removeClass(c.openNm); $target.stop().slideUp(c.speed); } else { self.addClass(c.openNm); $target.stop().slideDown(c.speed); EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); } }); }, /* * @method floating */ j$.floatingControlHasCookie = function (){ // vars var u = new EPOS_CARD.Util(); var $elm = j$('[id*="floatingWrap"]'), closeNm = "floatingNone", $close = j$(".floatingClose"), $toggleElm = j$(".floating-toggle"); if($elm.length === 0){ return false; } // close if($close.length !== 0){ $close.on("click",function(){ if($elm.hasClass(closeNm)){ j$.cookie("floatingDisplay","hide", {path: "/virtual" }); } else { j$.cookie("floatingDisplay","show", {path: "/virtual" }); } }); } // load u.$win.on("load", function(){ if(j$.cookie("floatingDisplay") == "hide"){ $elm.addClass(closeNm); $toggleElm.hide(); } }); }, /* * @method checkListAnimation */ j$.slider = function (){ // vars var $elm = j$('.js-vcSlider'); if($elm.length === 0){ return false; } if(u.isRangeSP()){ $elm.slick({ slidesToShow: 1, slidesToScroll: 1, variableWidth: true, centerMode: true, centerPadding: '0px', speed: 400, dots: true, dotsClass: 'vc-sliderDots', infinite: false }); } }; })(jQuery);