0
私はajaxingしている画像のギャラリーがあり、私はそれらを削除させたいと思います。だから、それぞれの上にマウスを置くと、Xの小さな画像がコーナーに表示され、クリックするとその画像が削除されます。ここで私はこれがあるjQuery画像on画像
$(".previews").live('mouseenter', function(){
console.log('mouse detected');
console.log($(this).id);
$(this).css({position:'relative'});
$('<div />').text(' ').css({
'height': $(this).height(),
'width': $(this).width(),
'background': 'url(delete.png) top left no-repeat',
'position': 'absolute',
'top': 15,
'left': 170,
'opacity': 0.0
}).addClass("hover-tile").bind('mouseleave', function(){
$(".hover-tile").each(function() { $(this).remove(); });
})
});
持っているものを何ごとのようなルックスにajax'dされた画像:今
<div><ul><li class='spacer' style='list-style:none;'><img class='previews' id='" + image_id + "' src='http://whatever.com/default.jpg' /></li></ul></div>";
、にconsole.log($(この).ID)。定義されていないものが返され、delete.pngが表示されません。また、live()が減価償却されているjQuery APIウェブサイトを読みましたが、代わりにon()を使用する必要がありますか?
.on()は、廃止予定の宣言済みで、今後のバージョンから削除される可能性があります。 – techfoobar