$(function() { var time = 500; $('#jump-nav a[href^=#]').click(function() { var target = $(this.hash); if (!target.length) return ; var targetY = target.offset().top; $('html,body').animate({scrollTop: targetY}, time, 'swing'); window.history.pushState(null, null, this.hash); return false; }); var img_dev; function win_wid(){ win_w = $(window).width(); if(win_w <= 721 && img_dev != 'smp'){ $('.img_chg').css({'opacity': '0'}); $('.img_chg').each(function(){ $(this).attr('src', $(this).attr('src')+'_s'); $(this).load(function(){ $(this).css({'opacity': '1'}); }); }); img_dev = 'smp'; }else if(win_w > 720 && img_dev != 'pc'){ $('.img_chg').each(function(){ if($(this).attr('src').endsWith('_s')){ $(this).attr('src', $(this).attr('src').slice( 0, -2 )); } }); img_dev = 'pc'; } } win_wid(); $(window).resize(function(){ win_wid(); }); });