CSS Opacity in Opera using jQuery

Whilst attempting to cross browser test a jQuery plug-in that I’m currently working on, I noticed that my opacity settings were being ignored in my current version of Opera (9.23).

$("#id").css({opacity: 0.8});

It turns out that the latest version of jQuery (1.3.1) doesn’t believe that Opera 9.2 supports CSS opacity, and therefore it is ignored completely.

There are two possible fixes for this, the first is to simply upgrade Opera to a newer version (the latest is 9.6.3).

The second option is to tell jQuery that opera does support opacity using the following – or similar – within your script:

if ($.browser.opera) {
    $.support.opacity = true;
}

2 Replies to “CSS Opacity in Opera using jQuery”

  1. It’s not the first Jquery-Opera bug I’ve come by. Opera has problems with a few of their plugins as well. Namely crossfade and some features of the UI such as the Accordion. Opera has caused just as many problems for me (when using Jquery) as IE 6 does for CSS, only they’re less documented.

    – Brent

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s