0

ここに画像の説明を入力

画像が生成される div があります.result。生成された画像の上のレイヤーとして機能する div 内に背景画像を設定する必要があります。私は次のものを持っていますが、表示する画像を取得できません:

image.appendTo($(".result"))
  $button = $('<button class="btn btn-default remove">')
        .text('Remove')
        .on('click', function () {
            image.remove();
            $(this).remove();
            return false;
        });
    $button.appendTo($(".result").css("background-image", "url('iphone_5.jpg') no-repeat").css("z-index", "1000"));
});

スクリーンショットの右側の画像は、レンダリングされたクロップです。レンダリングされた画像の上に位置する必要がある背景 (上と左の境界線に沿って) に画像が表示されます。

4

2 に答える 2

0

プロパティで簡略background構文を使用しようとしていbackground-imageます。に変更する必要がありますbackground

image.appendTo($(".result"))
  $button = $('<button class="btn btn-default remove">')
        .text('Remove')
        .on('click', function () {
            image.remove();
            $(this).remove();
            return false;
        });
    $button.appendTo($(".result").css("background", "url('iphone_5.jpg') no-repeat").css("z-index", "1000"));
});
于 2014-10-24T15:27:43.487 に答える
0

http://www.w3schools.com/css/css_background.asp

body {
    background-image: url("gradient_bg.png");
    background-repeat: no-repeat;
}

また

body {
    background: url("gradient_bg.png") no-repeat;
}

お気に入り

image.appendTo($(".result"))
  $button = $('<button class="btn btn-default remove">')
        .text('Remove')
        .on('click', function () {
            image.remove();
            $(this).remove();
            return false;
        });
    $button.appendTo($(".result").css("background", "url('iphone_5.jpg') no-repeat").css("z-index", "1000"));
});

また

image.appendTo($(".result"))
  $button = $('<button class="btn btn-default remove">')
        .text('Remove')
        .on('click', function () {
            image.remove();
            $(this).remove();
            return false;
        });
    $button.appendTo($(".result").css("background-image", "url('iphone_5.jpg')").css("Background-repeat", "no-repeat").css("z-index", "1000"));
});

ああ、遅くする :c

于 2014-10-24T15:42:24.373 に答える