2013-03-14 94 views
1

在鼠标悬停的文本CRM上弹出一个弹出窗口。当我将鼠标悬停在文本上时,文本颜色应该改变 - 悬停时文本的颜色应该变为红色。悬停属性文本不工作

我在下面提供了我的代码。

我把悬停属性给我的班,但它不工作。我如何解决它?

http://jsfiddle.net/a5tjG/3/embedded/result/

.cubeTextStyleCRM:hover { 
    color: red; 
} 
$('document').ready(function() { 
       window.setTimeout(function() { 
        $('.cubeCellCRM').each(function() { 
         var htmlText = $(this).attr('data-text'); 
         $(this).append('<div class="cubeTextStyleCRM">' + htmlText + '</div>'); 

         $(this).hover(

         function() { 
          $(".cubeTextStyleCRM").append("<span class='divStock'>Customer Relationship Management</span>"); 

         }, 

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

      }); 

<div class="cubeCellCRM" data-text="CRM" data-caption=" 
           &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' &gt;Create&lt;/a&gt; &lt;div&gt; 
           &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' &gt;View/Edit&lt;/a&gt; &lt;/div&gt; 
           &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' &gt;Reports&lt;/a&gt;" 
         data-image="http://intra.defie.co/images/Desktop_icons_02.07.13/CRM.png"></div> 
        </div> 
+3

在HTML中没有'cubeTextStyleCRM'类。 – 2013-03-14 00:46:29

+0

对不起,它来自JS – user2045025 2013-03-14 03:05:58

回答

2

.cubeTextStyleCRM在你的CSS有color: #333 !important;被重写你的颜色。只要让它像color: #333;和你的:hover应该工作。如果由于某种原因,您无法访问CSS的那部分,请重新编写该规则,例如:

<style> 
.cubeTextStyleCRM { 
    color: #333; 
} 
.cubeTextStyleCRM:hover { 
    color: red; 
} 
</style>