• Stars
    star
    376
  • Rank 113,810 (Top 3 %)
  • Language
    JavaScript
  • Created almost 13 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Javascript to load a larger image where necessary

Responsive Enhance

This script will check whether an image is larger than a specified width and load a full resolution image if necessary.

<img id="demo" src="http://dummyimage.com/400x300" alt="Responsive Image" data-fullsrc="http://dummyimage.com/800x600">
<script>responsiveEnhance(document.getElementById('demo'), 400);</script>

This will replace the image with the image defined in the data-fullsrc when the image is wider than 400 pixels.