代码之家  ›  专栏  ›  技术社区  ›  tobiasmay

用jquery更改rgba alpha透明度[重复]

  •  4
  • tobiasmay  · 技术社区  · 14 年前

    可能重复:
    jQuery + RGBA color animations

    嘿,

    我想更改悬停时rgba值的不透明度,但不透明度保持在.07。也许你能帮我找出错误。

    CSS(即黑客在单独的文件中-无需在此提及)

    .boxcaption{
       float: left;
       position: absolute;
       height: 100px;
       width: 100%;
       background: rgb(255, 144, 11);
       background: rgba(255, 144, 11, 0.7);
    }
    

    JS

    var thumbslide = $('.boxgrid.captionfull').click(function() {
        $('.boxgrid.captionfull.clicked').removeClass('clicked').children('.cover').stop().animate({top: 230, background: 'rgba(255, 144, 11, 0.7)'}, 350);
        $(this).toggleClass('clicked').children('.cover').stop().animate({top: 0, height:"230px", background: 'rgba(255, 144, 11, 1)'}, 350);
    });
    
    2 回复  |  直到 14 年前
        1
  •  -5
  •   Daniel Node.js    14 年前

    jquery颜色插件不支持rgba。改为使用: link text

        2
  •  1
  •   scunliffe    14 年前

    我有这种感觉( 未测试 猜测)jquery没有检查的css background属性 rbga(...) 因此不应用黑客修复来更改 filter:alpha() .

    我想你需要换衣服 opacity:1 分开。

    .animate({top:0,height:"230px",background:'rgb(255, 144, 11)',opacity:1}, 350);