Minimalist Responsive Image jQuery Plugin responsive image js - Download Minimalist Responsive Image jQuery Plugin - responsive-image.js

Download Minimalist Responsive Image jQuery Plugin – responsive-image.js

Posted on

This time I will share jQuery Plugin and tutorial about Minimalist Responsive Image jQuery Plugin – responsive-image.js, hope it will help you in programming stack.

Minimalist Responsive Image jQuery Plugin responsive image js - Download Minimalist Responsive Image jQuery Plugin - responsive-image.js
File Size: 4 KB
Views Total: 342
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another jQuery based responsive image solution that loads the appropriate images for your cross-platform website to reduce network traffic and increase page load speed.

How to use it:

1. Add the jQuery responsive-image.js’ script to the page, after you’ve added jQuery.

1 <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
2 <script src="jquery.responsive-image.js"></script>

2. Insert an image into your web page and specify the image sources for different screen resolutions using HTML5 data attributes.

1 <img src="mobile.png"
2      data-mobile="mobile.png"
3      data-phablet="phablet.png"
4      data-tablet="tablet.png"
5      data-desktop="desktop.png"
6 >

3. Call the plugin on document ready and done.

1 $("body").responsiveImage();

4. Change the default breakpoints.

1 $("body").responsiveImage({
2  
3   // in pixels
4   mobile : 400,
5   phablet: 550,
6   tablet : 750,
7   desktop: 1000,
8    
9 });

This awesome jQuery plugin is developed by rakuishi. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net