This version is old school.
Please find jQuery plugins on npm.
Retinize
Retinize will upscale (using nearest neighbor) images to look correctly on retina screens. This is particularly useful for pixel art when you don't want to store an upscaled version.