当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - Change nav text on hover than change back to original text

问题描述:

I am using cufon and I am trying to figure out how to change navigation text on hover/mouse over then change back to the original text on mouse out/hover off. Right now when I hover over the nav tab that I want the text change it does but it doesn't change back to the original text, color or font.

Here is a link to my fiddle: http://jsfiddle.net/jsavage/4fPw6/

Basically I need "fall" in the nav to change to "coming soon" when the user hovers over or mouse over and when the user hovers off or mouse outs the text will change back to "fall"

Any help would be greatly appreciated! Thanks so much guys!

网友答案:

First of all, your script tags should be in the HTML and you need to include JQuery to make use of its functions.

Also you were modifying the text of .fall which is an li element and doesn't contain any text. You have to target the <a> tag inside it that contains the text you want to modify.

Here's the fiddle

网友答案:

There is a way using CSS only (bit hacky though):

.fall:hover:before {
    content: 'coming soon';
    font-size: 0.875em;
    color: #fff;
    text-transform:uppercase;
}
.fall:hover a {
    display: none;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: