简体   繁体   English

鼠标悬停时显示文字

[英]Having text show on mouseover

So I'm trying to have a background image disappear and then have some text appear in the div with a link. 因此,我试图使背景图片消失,然后在div中通过链接显示一些文本。 I've gotten the image to disappear on mouseover but I can't get the text to display. 我的图像在鼠标悬停时消失了,但无法显示文本。 Here is what I've got so far. 这是我到目前为止所得到的。 I'm kinda new to this stuff. 我对这个东西有点陌生。

/* 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: 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>

Styles: 样式:

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

If any more info is needed, lmk, thanks. 如果需要更多信息,lmk,谢谢。

Instead of 代替

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

try 尝试

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

也许只是拼写错误: #reslink#reslin

Your id on the anchor is "reslin" not "reslink" 您在锚点上的ID是“ reslin”而不是“ reslink”

Try this: 尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM