2017-10-27 1 views
0

私のページの別のセクションに特定のデータを追加するのにJSを使用していますが、追加されたオブジェクトにアニメーションのフェードを適用するのが難しいです。これは私の要素が既に読み込まれているためですか?htmlにアニメーションを追加するのが難しい

私のJSコード:

jQuery(document).ready(function ($) { 
$('#emcustom tr').mouseover(function(e) { 
e.stopPropagation(); 
var $this = $(this); 
var evtitle = $this.closest('tr').find('.evlink').text(); 
$("#agenda-title").html('<span id="feedback" style="display:none">' + evtitle + '</span>').hide().fadeIn('slow'); 
}); 
}); 

私のhtmlコード:

<div class="agenda-title" id="agenda-title"> </div> 

答えて

0

私はこのようなものを使うことができると思います。

jQuery(document).ready(function ($) { 
    $('#emcustom tr').mouseover(function(e) { 
     e.stopPropagation(); 
     var $this = $(this); 
     var evtitle = $this.closest('tr').find('.evlink').text(); 

     var temp = $('<span id="feedback" style="display:none">' + evtitle + '</span>').hide(); 
     $("#agenda-title").html(temp); 
     temp.fadeIn('slow'); 
    }); 
}); 

このヘルプが必要です。ありがとう。

+0

これは魅力的に機能しました!ありがとう – Sam

0

問題はここにある:

$('#emcustom tr').mouseover(function(e) { 

あなたがいることを言及するとして、これは、静的なHTMLで動作しますが、 htmlが追加されるので、これを試してください:

$("#container").on('mouseenter', '#emcustom ', function() { 

containerは、任意の親静的なhtmlタグのIDです。

関連する問題