2013-03-13 40 views
0

懸停功能適用於顯示警報.... 但我無法顯示追加與跨度標籤的文本.... 不知道什麼發生的事情與它... 提供下面我的代碼.....懸停功能工作警報但不能追加跨度標籤

$('document').ready(function() { 
    window.setTimeout(function() { 
     $('.cubeCell').each(function() { 
      var htmlText = $(this).attr('data-text'); 
      $(this).append('<div class="cubeTextStyle">' + htmlText + '</div>'); 
      $(this).hover(

      function() { 
       //alert("123"); 
       $(this).append($("<span> ***</span>")); 
      }, 

      function() { 
       $(this).find("span:last").remove(); 
      }); 
     }); 
    }, 600); 
}); 


<div class="cubeCell" 
    data-text="hover here" 
    class="desktopContactImage cubeCell" 
    data-caption="&lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='/Inventory/Partnumber/?ps=list' &gt;Register&lt;/a&gt; &lt;div&gt; &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='/Bom/Bom/?ps=list' &gt;Demo&lt;/a&gt; &lt;/div&gt; &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' &gt;Reports&lt;/a&gt;" 
    data-image="http://intra.defie.co/images/Desktop_icons_02.07.13/guest.png" 
></div> 
+0

請點擊TidyUp按鈕並按照說明清理您的小提琴。一團糟。 – isherwood 2013-03-13 01:33:56

+0

它附加***範圍。在IE 8中檢查它。我甚至沒有看到Chrome中的懸停文本。你使用什麼瀏覽器? – hop 2013-03-13 01:37:00

+0

我使用的是Chrome瀏覽器 – user2045025 2013-03-13 01:46:32

回答

0

我不太(任何)瞭解標記,你是如何實現紡紗箱,但我想知道你'正嘗試在cubeStyleText旁邊顯示文本,因爲您將該跨度附加到懸停時的相同位置,但是如果出現這種情況,它會顯示在框後面,而不是

$(this).append($("<span> ***</span>")); 

使用本

$(this).children(".cubeTextStyle").append($("<span> ***</span>")); 

這似乎解決了定位問題,如果這是它是什麼。