我正在为我的项目开发一个网站,我正在尝试合并一些简单的jQuery命令。他们似乎没有工作。如果我错过了什么,请仔细阅读并告诉我。
HTML代码:
<div class="button"> <a href="index.htm" class="a-top">Home</a></div>
<div class="button"> <a href="aboutus.htm" class="a-top">About us</a></div>
<div class="button"> <a href="contactus.htm" class="a-top">Contact us</a></div>
<div class="button-right" id="businesses"> <a href="forbusinesses.htm" class="a-top">For
businesses</a></div>
<div class="button-right"> <a href="forusers.htm" class="a-top">For users</a></div>
<div class="fluid-margin">
<div class="orange-body">
<div class="fake-header">
<img src="http://i879.photobucket.com/albums/ab358/dylanhusted/bulletnlogotranssmall_zpsa04c3fed .png" id="logo"/>
</div>
</div>
</div>
<div id="landing-page">
<div id="call-to-action">
<img src="https://scontent-b-lga.xx.fbcdn.net/hphotos-prn1/v/1608452_3821343707689_2110853534_n.jpg?oh=ab5ebfd5dce574e97a43e9a7c0739583&oe=52D0F2AC" id="learn-button"/>
</div>
<img src="https://scontent-b-lga.xx.fbcdn.net/hphotos-prn1/v/1551908_3821359708089_1101636385_o.jpg?oh=aa19a9ac5f5b5e4f3cf704858482803d&oe=52D11726"id="line"/>
</div>
<div class="footer">
<a href="index.htm" class="a-footer">Home</a>
<a href="aboutus.htm" class="a-footer">About Us</a>
<a href="contactus.htm" class="a-footer">Contact Us</a>
</div>
</body>
</html>
CSS代码:
body {
background-color: #ffffff;
}
#landing-page {
width: 100%;
position:relative;
width:100%;
padding-bottom: 40%;
height:0;
overflow:hidden;
z-index: -1;
}
#line {
margin-left: 0;
margin-bottom: 0;
width: 100%;
}
.orange-body {
width: 70%;
z-index: -3;
border-radius: 5px;
margin: auto;
}
.fluid-margin {
position:relative;
width:100%;
padding-bottom:8%;
height:0;
overflow:hidden;
}
.fake-header {
width: 70%;
position: absolute;
border-radius: 5px;
margin-top: 1%;
margin-left: 15%;
z-index: -0;
}
#logo {
width: 28%;
height: 63%;
margin-top: .7%;
margin-left: 14%;
z-index: 1;
}
.button {
display: inline-block;
font-family: Trebuchet MS;
color: #8d8d8d;
font-size: 110%;
padding: 5px;
}
jQuery代码:
$(document).ready(function() {
$('a').mouseover(function() {
(this).css("color", "#dfdbd8");
});
});
谢谢!
答案 0 :(得分:2)
尝试:
$('a').mouseover(function() {
$(this).css("color", "#dfdbd8");
});
所以我是个白痴!
在你的CSS中添加:
a:hover{color:#dfdbd8}
我读得不够近,你实际上并不需要JS去做!