简体   繁体   English

将鼠标悬停在弹出菜单上

[英]mouse over popup menu

Creating a website using simple html(not html5) and css but got stock in mouseover effect. 使用简单的html(不是html5)和CSS创建网站,但是鼠标悬停效果不错。 Need to show some text with background image when user mouseover a link. 用户将鼠标悬停在链接上时,需要显示一些带有背景图像的文本。 Following is an example.. 以下是一个示例。

NORMAL: 正常: 鼠标移出时

OVER: 过度: 替代文字

I don't think it is possible to create the effect with simple CSS. 我认为用简单的CSS来创建效果是不可能的。 My question is what is the most effective way to create the over effect and how? 我的问题是产生过度影响的最有效方法是什么? Javascript, DHTML or other language... Javascript,DHTML或其他语言...

Thanks in advance...Rex... 在此先感谢...雷克斯...

Rex, 雷克斯

I think you would find jQuery very useful. 我认为您会发现jQuery非常有用。 jQuery is a javascript framework, very easy to use. jQuery是一个javascript框架,非常易于使用。 www.jquery.com www.jquery.com

You can achieve your effect with pure javascript, but again I think you will find using a javascript framework much easier, since your coming from actionscript. 您可以使用纯JavaScript来达到效果,但是我想您会发现使用javascript框架要容易得多,因为您来自ActionScript。

For your particular instance I would make a div absolutely positioned. 对于您的特定实例,我将使div绝对定位。 To show the div on mouseover you can use the jQuery $("#div_id").show(); 要显示鼠标悬停时的div,可以使用jQuery $(“#div_id”)。show();。 and on mouseout use .hide(); 并在mouseout上使用.hide();

Here is a basic tutorial for using show hide on events with jQuery. 这是在jQuery事件上使用show hide的基本教程。

http://www.learningjquery.com/2006/09/slicker-show-and-hide http://www.learningjquery.com/2006/09/slicker-show-and-hide

Good luck! 祝好运!

You can use javascript to show a hidden div which is having text written inside it. 您可以使用javascript来显示隐藏的div,该div的内部写有文字。

use javascript's onmouseover and onmouseout events to do this. 使用javascript的onmouseover和onmouseout事件来执行此操作。

However have you tried using href:hover property of css to achieve this? 但是,您是否尝试过使用CSS的href:hover属性来实现这一目标?

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

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