简体   繁体   English

悬停菜单时如何显示描述?

[英]how to make a description appear when hovering the menu?

I have the following image of a trophy on my main page and I would like to make a small description appear when a user hovers over it just as on this site.我的主页上有一个奖杯的以下图像,我想在用户将鼠标悬停在它上面时出现一个简短的描述,就像在这个网站上一样。 When I hover over the icons on the top right, I can see some description.当我将鼠标悬停在右上角的图标上时,我可以看到一些描述。 Is this done through onclick?这是通过onclick完成的吗? It looks neater than just having a paragraph description....它看起来比只有段落描述更整洁....

It would be done using onMouseOver to call the function to display or update the element that shows the description.可以使用 onMouseOver 调用函数来显示或更新显示描述的元素。 See below example见下面的例子

<a href='link.html' onMouseOver='showDescription();'><img src='icon.png'></a>

Hope this helps希望这可以帮助

您可以使用title属性执行此操作。

 <img src="https://unsplash.it/50" title="some text">

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

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