在jQuery clone()上修改图像的显示大小

时间:2013-12-17 17:47:00

标签: jquery

我正在将一个对象(图像)复制到另一个元素中。如何在运行中更改目标元素中显示的大小?

<div id="eleWithImgs">
    <img id="ph01" src=".../image01.jpg">
    <img id="ph02" src=".../image02.jpg">
    ...


$('#eleWithImgs').children().each(function() {

    $($(this), {
        width:  // ??
        height: // ??
    }).clone().appendTo('#destinationEle');

});

1 个答案:

答案 0 :(得分:1)

为克隆元素设置CSS属性:

$('#eleWithImgs').children().each(function () {
    $(this).clone().css({
        width: // ??
        height: // ??
    }).appendTo('#destinationEle');
});

我希望你的问题不是如何填写?? ...