2014-01-10 52 views
0

我正在为我的一个项目的网站工作,我正在尝试合并一些简单的jQuery命令。他们似乎没有工作。请通读,让我知道如果我失去了一些东西。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

控制台窗口中的任何错误? – Jason

+3

如果这是你所有的HTML,你不包括jquery.js –

+2

$(this).css(“color”,“#dfdbd8”);'你忘记'$'并且不要犹豫打开你的控制台; ) –

回答

2

尝试:

$('a').mouseover(function() { 
    $(this).css("color", "#dfdbd8"); 
    }); 

所以我是个白痴!

在你的CSS地址:

a:hover{color:#dfdbd8} 

我没看过足够接近,并且您不实际需要JS做到这一点!

+0

谢谢你指出我的错误。我改正了它,但是当我将鼠标放在超链接上时,我的文本颜色仍然没有改变。 –

+0

硬刷新你的页面,可能是一些缓存,仍旧服务于旧的CSS。 – Rao

+0

哇,我不知道我可以在我的CSS文件中做到这一点!谢谢您的帮助。 –