2013-03-13 39 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>")); 

这似乎解决了定位问题,如果这是它是什么。