admin管理员组

文章数量:1026989

With jQuery, i'm trying to do

item.css("-o-box-shadow")

or:

item.css("box-shadow")

... but getting empty string.

Under Webkit and Gecko it works, using "-webkit" and "-moz" prefixes.

How to do it under Opera ?

I've also tried "boxShadow", but again, getting empty string.

$(".flag").css("boxShadow", "rgba(0,0,0,0.5) 4pt 4pt 7pt"); // i see, it was set
$(".flag").css("boxShadow"); // returns ""

With jQuery, i'm trying to do

item.css("-o-box-shadow")

or:

item.css("box-shadow")

... but getting empty string.

Under Webkit and Gecko it works, using "-webkit" and "-moz" prefixes.

How to do it under Opera ?

I've also tried "boxShadow", but again, getting empty string.

$(".flag").css("boxShadow", "rgba(0,0,0,0.5) 4pt 4pt 7pt"); // i see, it was set
$(".flag").css("boxShadow"); // returns ""
Share Improve this question edited Mar 3, 2011 at 14:27 thirtydot 228k50 gold badges392 silver badges354 bronze badges asked Mar 3, 2011 at 12:55 AntonALAntonAL 17.5k21 gold badges84 silver badges118 bronze badges 1
  • 1 If anybody thinks they've solved this, please provide an example where you retrieve the box-shadow property which was set via CSS. – thirtydot Commented Mar 3, 2011 at 14:09
Add a ment  | 

5 Answers 5

Reset to default 3

$('div').css('boxShadow','10px 10px 10px #FF00FF');

so: .css('boxShadow');

After searching and trying for the last fifteen minutes, I think Opera has a bug.

You just can't retrieve the box-shadow value, unless there's some obscure undocumented way.

this sounds like an issue with the way Opera has implemented boxShadow. i will see what i can dig up about why that value isn't available.

in the meantime, using your example, i think you can retrieve the entire style using $(".flag").attr("style") then split the string on the ':'.

Seeing as you want to use jQuery you can use this:

$('.item').css('boxShadow','5px 5px 6px #333333');

Example here for you :) (open in Opera)

This is likely a bug in Opera. jQuery's .css() method uses getComputedStyle || currentStyle to return CSS properties, both of which return the empty string for boxShadow.

With jQuery, i'm trying to do

item.css("-o-box-shadow")

or:

item.css("box-shadow")

... but getting empty string.

Under Webkit and Gecko it works, using "-webkit" and "-moz" prefixes.

How to do it under Opera ?

I've also tried "boxShadow", but again, getting empty string.

$(".flag").css("boxShadow", "rgba(0,0,0,0.5) 4pt 4pt 7pt"); // i see, it was set
$(".flag").css("boxShadow"); // returns ""

With jQuery, i'm trying to do

item.css("-o-box-shadow")

or:

item.css("box-shadow")

... but getting empty string.

Under Webkit and Gecko it works, using "-webkit" and "-moz" prefixes.

How to do it under Opera ?

I've also tried "boxShadow", but again, getting empty string.

$(".flag").css("boxShadow", "rgba(0,0,0,0.5) 4pt 4pt 7pt"); // i see, it was set
$(".flag").css("boxShadow"); // returns ""
Share Improve this question edited Mar 3, 2011 at 14:27 thirtydot 228k50 gold badges392 silver badges354 bronze badges asked Mar 3, 2011 at 12:55 AntonALAntonAL 17.5k21 gold badges84 silver badges118 bronze badges 1
  • 1 If anybody thinks they've solved this, please provide an example where you retrieve the box-shadow property which was set via CSS. – thirtydot Commented Mar 3, 2011 at 14:09
Add a ment  | 

5 Answers 5

Reset to default 3

$('div').css('boxShadow','10px 10px 10px #FF00FF');

so: .css('boxShadow');

After searching and trying for the last fifteen minutes, I think Opera has a bug.

You just can't retrieve the box-shadow value, unless there's some obscure undocumented way.

this sounds like an issue with the way Opera has implemented boxShadow. i will see what i can dig up about why that value isn't available.

in the meantime, using your example, i think you can retrieve the entire style using $(".flag").attr("style") then split the string on the ':'.

Seeing as you want to use jQuery you can use this:

$('.item').css('boxShadow','5px 5px 6px #333333');

Example here for you :) (open in Opera)

This is likely a bug in Opera. jQuery's .css() method uses getComputedStyle || currentStyle to return CSS properties, both of which return the empty string for boxShadow.

本文标签: javascriptHow to get boxshadow programmatically under OperaStack Overflow