如何使用jQuery设置图像的高度,宽度 [英] How to set height , width to image using jquery
本文介绍了如何使用jQuery设置图像的高度,宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用jquery设置图像的高度和宽度? 以下是我的代码
Is there any way to set height and width of an image using jquery? The following is my code
var img = new Image();
// Create image
$(img).load(function(){
imgdiv.append(this);
}).error(function () {
$('#adsloder').remove();
}).attr({
id: val.ADV_ID,
src: val.ADV_SRC,
title: val.ADV_TITLE,
alt: val.ADV_ALT
});
谢谢.
推荐答案
var img = new Image();
// Create image
$(img).load(function(){
imgdiv.append(this);
}).error(function () {
$('#adsloder').remove();
}).attr({
id: val.ADV_ID,
src: val.ADV_SRC,
title: val.ADV_TITLE,
alt: val.ADV_ALT
}).height(100).width(100);
这篇关于如何使用jQuery设置图像的高度,宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文