gpt4 book ai didi

javascript - 如何在 JQuery 中调整图像大小

转载 作者:行者123 更新时间:2023-11-28 21:01:10 25 4
gpt4 key购买 nike

这里要改变尺寸吗?我找不到正确的方法

var img = new Image();
img.src = newImg.ImagePath;

最佳答案

$(img).width(width_in_pixels).height(height_in_pixels);

除了$(img),您还可以使用$('selector')。如果您想创建一个新的,请使用:

$('<img/>', {src: 'url to the image'}).width(width_in_pixels).height(height_in_pixels).appendTo('#someElement');

关于javascript - 如何在 JQuery 中调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11027237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com