/* =========================================== common.js =========================================== */ /*=========================================== setting true OR false =========================================== */ //pegetopボタン途中で止める var pagetopStop = true; //PC SP 画像切り替え var imageSwitch = true; /*=========================================== function =========================================== */ (function($){ $(document).ready(function(){ /* js-toggle ------------------------------------- */ if($('.js-toggle-tit').length){ $('.js-toggle-tit').on('click',function(){ $(this).toggleClass('on'); $(this).next('.js-toggle-content').slideToggle('fast'); }); } /* js-switch-img ------------------------------------- */ if(imageSwitch){ $(function() { var replaceWidth = 768; function imageSwitch(){ var windowWidth = parseInt($(window).width()); $('img[src*="_sp."],img[src*="_pc."]').each(function(){ if(windowWidth >= replaceWidth){ $(this).attr('src',$(this).attr('src').replace('_sp.', '_pc.')); }else{ $(this).attr('src',$(this).attr('src').replace('_pc.', '_sp.')); } }); } imageSwitch(); var resizeTimer; $(window).on('resize',function(){ clearTimeout(resizeTimer); resizeTimer = setTimeout(function(){ imageSwitch(); },200); }); }); } }); })(jQuery);