Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#839 closed bug (fixed)

Setting opacity fails in jQuery 1.1

Reported by: dossy@… Owned by:
Priority: major Milestone: 1.1
Component: core Version: 1.1
Keywords: css opacity Cc:
Blocked by: Blocking:

Description

Setting opacity in jQuery 1.1 fails with the following error:

Error in parsing value for property 'opacity'. Declaration dropped.

Here's the code:

$('#element').css({
    filter: 'alpha(opacity=60)',
    '-moz-opacity': 0.6,
    opacity: 0.6
}); 

This code worked in jQuery 1.0.3.

Change History (3)

comment:1 Changed 13 years ago by dossy@…

I forgot to mention, I'm on Firefox 1.5.0.9.

Also, in the meantime, I'm using the following workaround:

$('#element').css({
    filter: 'alpha(opacity=60)',
    '-moz-opacity': 0.6
})[0].style.opacity = 0.6;

This is not the preferrable method for obvious reasons. :-)

comment:2 Changed 13 years ago by dossy@…

Interesting, this also worked:

$('#element').css({
    filter: 'alpha(opacity=60)',
    '-moz-opacity': '0.6',
    opacity: '0.6'
});

Note: the values 0.6 are strings ("0.6") instead of floats (0.6). That's annoying ...

comment:3 Changed 13 years ago by john

Milestone: 1.1
Resolution: fixed
Status: newclosed

Fixed in SVN, we were accidentally appending a 'px' to the opacity number.

Note: See TracTickets for help on using tickets.