/* スクロール 可視領域 クラス付与 ------------------------------------------------------------------------------------------------------------*/ (function () { $('.mod-freeHTML .textTillate01').stop().animate({ opacity: "1"}, 300); $('.mod-freeHTML .textTillate01').textillate({loop: false, in: {effect: 'rotateIn'}}); $('.mod-freeHTML .area-point').on('inview', function(event, isInView, visiblePartX, visiblePartY) { if (isInView) { $(this).stop().animate({ opacity: "1"}, 1000 ,function(){ }); $(this).find("h2").textillate({loop: false, in: {effect: 'bounceIn',delay: 50, sync: false}}) } }); $('.mod-freeHTML .area-summary').on('inview', function(event, isInView, visiblePartX, visiblePartY) { if (isInView) $(this).children(".ulLarge01").children("li").textillate({loop: false, in: {effect: 'rotateIn'}}); }); $('.mod-freeHTML .area-fadein').on('inview', function(event, isInView, visiblePartX, visiblePartY) { if (isInView) $(this).stop().animate({ opacity: "1"}, 1000); }); }) /* スクロール 可視領域 クラス付与 ------------------------------------------------------------------------------------------------------------*/ (function (doc) { doc.addEventListener('DOMContentLoaded', function () { var WatchScroll = function () { var reg = new RegExp('(^| +)k_ca($| +)'), el = document.getElementsByTagName('*'); this.nodeList = []; for (var i = 0; i < el.length; i++) { if (reg.test(el[i].className)){ this.nodeList[i] = { obj: el[i], flg: true, parlentoffsetY: this.offsetTopAll(el[i]) }; this.scrollEvent(this.nodeList[i]); } } return this; }; WatchScroll.prototype.scrollEvent = function (target) { //スクロールイベント監視 var this_ = this; window.addEventListener('scroll',function (e) { if (target.flg) { if (window.pageYOffset > (target.parlentoffsetY - document.documentElement.clientHeight)+250) { this_.changeAttr(target); } } },false); return this; }; WatchScroll.prototype.offsetTopAll = function (target) { //BodyまでのoffsetTopトータル var top = 0; (function (p, y) { if(p.offsetParent.nodeName !== 'BODY'){ y += p.offsetTop; arguments.callee(p.offsetParent, y); }else{ y += p.offsetTop; top = y; return; } }(target, top)); return top; }; WatchScroll.prototype.changeAttr = function (target) { //classを追加する処理 var end_styles = target['obj'].getAttribute("data-kca-class"), default_class = target['obj'].getAttribute('class'); if (end_styles !== null) { target.flg = false; (function (target_, default_class_, end_styles_) { setTimeout(function() { target_['obj'].setAttribute('class', default_class_ + ' ' + end_styles_); }, 500); }(target, default_class, end_styles)); } return this; }; var watchscroll = new WatchScroll(); }, false); }(document)); $(function() { /* スマホ時 クラス名imgPcSpのimgタグのsrcパス書き換え ------------------------------------------------------------------------------------------------------------*/ //スマホ切り替えサイズ var $spWidth = 1024; $(window).on('load resize', function(){ var w = $(window).width(); var x = $spWidth; //画像を差し替えを実行するウィンドウサイズ // 画面サイズに応じて画像を変える if (w <= x) { var before = '/pc/',after = '/sp/'; replaceImg(); $("#divCategory01").addClass("divModeSP"); $("#divCategory01").removeClass("divModePC"); } else { var before = '/sp/', after = '/pc/'; replaceImg(); $("#divCategory01").addClass("divModePC"); $("#divCategory01").removeClass("divModeSP"); } function replaceImg(){ $('.imgPcSp').each(function(){ var img = $(this).attr('src').replace(before, after); if( $(this).attr('src').match(before) ) { $(this).attr('src', img); } }); } }) });