Pages

Ruchi Tech

Monday, 9 July 2012

Resize Images Using JQuery


Write a JQuery function for Image Resizing:


$(document).ready(function(){     $('imgresize').each(function(){         var maxWidth = 500;         var ratio = 0;         var img = $(this);         if(img.width() > maxWidth){             ratio = img.height() / img.width();             img.attr('width', maxWidth);             img.attr('height', (maxWidth*ratio));           }     }); });

This script simply resize your image.

1 comment:

  1. To see bigger picture click and then if you want to save, right click on picture and choose Save as. pirater un compte facebook

    ReplyDelete