jquery - 我的一张图片不受 CSS 不透明度的影响

标签 jquery html css image opacity

我有两个箭头之一,我不是指指点点(它的 id="darrow")并没有受到我的不透明度的影响:0.7;我的 CSS 中的属性。谁能看出哪里出了问题?在我添加第二个箭头和动画之前它工作正常。然而,另一个箭头似乎完美无缺。

HTML:

<img src="images/stills/uarrow.png" id="uarrow">
<img src="images/stills/darrow.png" id="darrow"> <!--Problem arrow-->
<div id="footer">
<p id="fpara">Site/logo design by Zachary Ledyard.</p>
</div>

CSS:

#darrow
{
    bottom: 20px;
}

#uarrow
{
    bottom: -40px;
}

#darrow, #uarrow
{
    position: fixed;
    left: 50%;
    margin-left: -9px;
    padding: 0;
    width: 18px;
    height: 14px;
    opacity: 0.7;
    z-index: 11;
}

#darrow, #uarrow:hover
{
    opacity: 1.0;
}
#footer
{
    padding: 0;
    width: 100%;
    height: 70px;
    position: fixed;
    bottom: 0;
    border-top: 1px solid #000000;
    z-index: 6;
    background-color: rgba(255, 128, 0, 0.7)
}

JQuery;

$(document).ready(function(){
  $("#darrow").click(function(){
    $("#footer").animate({"top": "+=100px"}, "slow");
    $("#uarrow").animate({"top": "-=50px"}, "slow");
    $("#darrow").animate({"top": "+=100px"}, "slow");
  });
});

$(document).ready(function(){
  $("#uarrow").click(function(){
    $("#footer").animate({"top": "-=100px"}, "slow");
    $("#uarrow").animate({"top": "+=50px"}, "slow");
    $("#darrow").animate({"top": "-=100px"}, "slow");
  });
});

最佳答案

我相信你的意思是 #darrow:hover。您正在覆盖原始的不透明度。

你需要:

#darrow:hover, #uarrow:hover
{
    opacity: 1.0;
} 

你有:

#darrow, #uarrow:hover
{
    /* this is replacing the previous opacity of 0.7 for #darrow */
    opacity: 1.0;
}

关于jquery - 我的一张图片不受 CSS 不透明度的影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21421377/

相关文章:

jquery - 在 ('click' 上)使用 load() 函数加载页面后,jquery 不起作用

javascript - 粘性标题动画线性背景颜色

javascript - 修改 slider (www.basic-slider.com)以显示上一张和下一张幻灯片

html - 将一个 div 拆分为网格或多个 div 的任何方法

css - 显示 inline-flex 会影响 child 吗?

javascript - ng-repeat 元素没有显示

javascript - 哪个按钮切换 Bootstrap 模式

javascript - 将鼠标悬停在链接上时激活覆盖背景

javascript - 按类名监听 href 的点击事件

c# - 更改所有asp的默认样式 :HyperLink tags