javascript - jQuery 命令不起作用

标签 javascript jquery html css web

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

相关文章:

html - jsp页面没有从mysql获取数据

javascript - 有没有办法使用java代码在浏览器中启用javascript?

javascript - 如何在单独的窗口中加载所有 href 链接

javascript 正则表达式跳过方括号

javascript - 类型错误 : Failed to execute 'removeChild' on 'Node' : parameter 1 is not of type 'Node' in React

javascript - jQuery检测下拉值被选中,即使它没有改变

javascript - 如何在 jQuery 中以相同的速度为每个元素设置动画?

javascript - 切换 css 和 html

javascript - 带有页眉和页脚的 jQuery ListView

javascript - 在 javascript 中检索隐藏字段值的问题