gpt4 book ai didi

javascript - jQuery 命令不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 04:08:26 24 4
gpt4 key购买 nike

我正在为我的一个元素开发一个网站,我正在尝试合并一些简单的 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");
});
});

谢谢!

最佳答案

尝试:

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

所以我是个白痴!

在你的CSS中添加:

a:hover{color:#dfdbd8}

我读得不够仔细,你实际上不需要 JS 来做!

关于javascript - jQuery 命令不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21051361/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com