changing rgba alpha transparency with jquery [duplicate]

℡╲_俬逩灬. 提交于 2019-12-10 16:05:04

问题


Possible Duplicate:
jQuery + RGBA color animations

hey,

i want to change the opacity of an rgba value on hover, but the opacity stays at .07.. maybe ou can help me find the mistake.

CSS (IE hacks are in seperate file - no need to mention them here)

.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);
});

回答1:


the jquery color plugin doesn't support rgba. use this instead: link text




回答2:


I get the feeling (untested guess) that jQuery is not checking the CSS background property for rbga(...) and thus not applying a hack fix to change the filter:alpha().

I think you'll need to change opacity:1 separately.

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


来源:https://stackoverflow.com/questions/4194745/changing-rgba-alpha-transparency-with-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!