レスポンシブ、画面幅によって画像を切替える
jQuery(function($){
$(window).on('load resize', function() {
window_w = window.innerWidth;
is_mobile = (window_w < 641) ? true : false;
change_img();
});
});
function change_img() {
var $img = $('.js-change-img');
$img.each(function(){
img_pc = $(this).attr('data-img-pc'),
img_sp = $(this).attr('data-img-sp');
if(is_mobile){
$(this).attr('src', img_sp);
} else {
$(this).attr('src', img_pc);
}
});
}