アムマウスがdiv要素の上に置いたときに削除アイコンを表示しようとして機能していないが、ホバーイベントは決して に動作しない。ここに私のコード この関数は、データホバーイベントが
function load_pheeds()
{
var request_url = url+'pheeds/latest_pheeds';
var timeline = $('#pheed-timeline');
var loading = '<div class="progress-indicator">Loading Pheeds....</div>';
timeline.append(loading);
$.ajax({
url:request_url,
type:'GET',
dataType:'json',
error:function() { },
success:function(data)
{
if(data.message == null)
{
$('.progress-indicator').fadeOut('slow',function() {
$.each(data,function(index,pheed)
{
var del = '';
if(pheed.owner == "yes")
{
del = '<a href="#" class="deletePheed" style="display:none;">Delete Pheed</a>';
}
timeline.append(
'<div class="pheed-holder" data-id="'+pheed.pheed_id+'" data-delete="'+pheed.owner+'">'+
'<div class="user-profile-avatar"><img src="'+pheed.avatar_src+'" /></div>'+
'<div class="useridentity" data-userid="'+pheed.user_id+'">'+
'<a href="'+url+'users/info/'+pheed.username+'">'+pheed.username+'</a>'+
'</div>'+del+
'<div class="pheedContent">'+pheed.pheed+'</div>'+
'<div class="pheedMeta">'+
'<span class="timefield t:'+pheed.datetime+'000"></span>'+
'<span class="comment-count">'+pheed.comment_count+'</span>'+
'</div>'+
'</div>'
);
});
});
}
}
});
}
これは、イベントであるとのdivを表示しますハンドラ
$('div.pheed-holder').hover(function() {
$(this).children('.deletePheed').show();
},function() {
$(this).children('.deletePheed').hide();
});
イベントのDOMオブジェクトは、このような動的な場合ホバーイベントが
[それは私のためにうまくいく](http://jsfiddle.net/Hqw7T/)おそらくあなたはラインのどこかでJavaScriptエラーが発生していますか?アンカーが実際にHTMLに挿入されていることを確認しましたか? – animuson
'$(this)).find("。deletePheed ")' –
@JamesJohnsonを試してみました – MrFoh