for mobile version of my site, I need to change the size of my icons.
This way I give those Icons that are too small the class "icon".
Then I iterate all img.icon's and want to change their size:
$$("img.icon").each(function (e) {
// what to do now? e.setStyle({width: (e.width * 2).toString() + "px"});
});
How do I get the width and heigh开发者_如何学编程t of an image in pixels as an integer?
Thanks, yours Joern.
Try this:
e.setStyle({width: (e.getDimensions().width * 2).toString() + "px"});
Also, like @clockworkgeek said, make sure to place the above code in a function that waits for the DOM to be loaded, and the image as well.
精彩评论