在mouseover上显示文本

时间:2010-07-30 03:59:44

标签: javascript jquery css

所以我试图让背景图像消失,然后在div中出现一些带有链接的文本。我已经让图像在鼠标悬停时消失但我无法显示文本。这是我到目前为止所得到的。我对这些东西不熟悉。

/* I'm have the image removed with the first line, then setting the link
   as hidden then trying to make it visible, but the link never shows */

$('#res').mouseover(function(){
  $(this).removeClass('resume');
  $('#reslink').css(visibility,visible);
});

HTML:

        <div id = "res" class = "floatleft squares resume"><a id = "reslin" class = "link" href="resume.php">link</a></div>
  <div id = "pro" class = "floatleft squares projects"><a id = "prolin" class = "link" href="projects.php"></a></div>
  <div id = "con" class = "floatleft squares contact"><a id = "conlin" class = "link" href="contact.php"></a></div>
  <div id = "abo" class = "floatleft squares about"><a id = "abolin" class = "link" href="about.php"></a></a></div>

样式:

a{
 display: block;
 background: grey;
 height: 100%;
 width: 100%; 
 visibility: hidden;
}

如果需要更多信息,请谅解,谢谢。

3 个答案:

答案 0 :(得分:1)

而不是

$('#reslink').css(visibility,visible)

$('#reslin').css('visibility','visible')

答案 1 :(得分:0)

也许这只是一个错字:#reslink#reslin

答案 2 :(得分:0)

您在锚点上的ID是“reslin”而不是“reslink”

试试这个:

 $('#reslin').css("visibility", "visible");
 or
 $('#reslin').css("display", "block");