开发者

How to increase height and width of an image in jquery up to a certain limit?

开发者 https://www.devze.com 2022-12-21 03:17 出处:网络
I have two images and those are layered on each other using z-index. I want to increase their height and width by 20 from their current height and width whenever a button is clicked.

I have two images and those are layered on each other using z-index. I want to increase their height and width by 20 from their current height and width whenever a button is clicked. I have assigned height and width to one image using a css class and for another image using style property in <img> tag.

Friends! I increased the height and width of one image by setting its height and 开发者_StackOverflow社区width. But this is achieved by hard coding so it works only one time i.e. when button is clicked first time.

Question 1. How can I increase the height and width of both images at the same time from their current height and width?

Please guide me friends!


Have you tried width and height functions:

var img = $('#imgid');
img.width(img.width() + 20);
img.height(img.height() + 50);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号