Java Script for Image Re-sizing
Hi,
I have an image element on the page and the image path is returned from the service and mapped to the image element. Images returned from the service are of variable sizes (height and width) and I want to accordingly re-size the image according to a fixed size on screen. Fixed size means Height = 75px and width = width of container.
I have used a java script attached below, which I invoke on a button click and this works perfectly fine to re-size the image. However, I want to invoke this Java script automatically rather than on button click. I tried it on successful service response but it didn't work. Pls suggest.
Code: Select all
Appery('mobileimage_340').attr("style", "width: auto !important; height: auto !important;");
var image = Appery('mobileimage_340');
var parcont = Appery('mobilegrid_60');
var iwidth = image.width();
var iheight = image.height();
var parwidth = parcont.width();
var parheight = 75;
var wratio = parwidth / iwidth;
var hratio = parheight / iheight;
nwidth = aratio * iwidth;
nheight = aratio * iheight;
Appery('mobileimage_340').attr("style", "width : " + nwidth + "px !important; height : " + nheight + "px !important;");