【发布时间】:2015-03-29 01:05:05
【问题描述】:
我正在尝试将按钮的背景颜色从蓝色渐变为白色,并将字体颜色从白色渐变为蓝色。我检查了其他帖子。
这是我的小提琴: http://jsfiddle.net/t533wbuy/1/
我用这个小提琴作为参考: http://jsfiddle.net/visualdecree/SvjHx/
我的问题是:
- 我希望它是一个 A 按钮,而不是使用 ul > li。
- 字体颜色在悬停时不会变成白色。
CSS
.menuitem{
width: 200px;
height:30px;
background-color: #005abb;
font-size:16px;font-family: 'gotham_htfbold';-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
}
.menuitem a{
width: 200px;
height: 30px;
height: auto;
display: block;
position: relative;
color: #FFF;
text-align: center;
z-index: 9999;
}
.menu-item-span{
display: none;
width: 200px;
height: 30px;
background-color: #fff;
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
color:#005abb;
z-index: -999;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
}
html
点击这里申请
jquery
$(function() {
$(".menuitem").find("class")
.hide() // Finds span hide.
.end() // After find stop.
.hover(function() { // On hover find and fadein then fadeout
$(this).find("span").stop(true, true).fadeIn();
}, function() {
$(this).find("span").stop(true, true).fadeOut();
});
});
【问题讨论】:
-
你可以只用 CSS 来做到这一点