Last active
May 29, 2016 05:08
-
-
Save nishinoshake/17fef6581f5e914665f5 to your computer and use it in GitHub Desktop.
画像のPC/SP切り替え
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changeImage(){ | |
var pcSuffix = '_pc', | |
spSuffix = '_sp', | |
breakPoint = 480; | |
$('.resimg').each(function(){ | |
var $img = $(this); | |
if ( window.innerWidth < breakPoint ) { | |
$img.attr('src',$img.attr('src').replace(pcSuffix,spSuffix)); | |
} else { | |
$img.attr('src',$img.attr('src').replace(spSuffix,pcSuffix)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment