开发者

Check opacity by jQuery

How 开发者_StackOverflowdo I check if the opacity of an element is 0, and then do something in jQuery?


Have you tried using .css()?

if($('elemFoo').css('opacity') == 0) {
    doSomething();
}


You can do as

$(function() {

    if ($('#foo').css('opacity') == 0)
        alert('lol');

});

Demo : http://jsfiddle.net/9GEZ5/


if( $("#id_of_your_thing").css('opacity') == "0" )
  do_stuffs();


var currentOpacity = jQuery.fx.step.opacity

if(currentOpacity == 0)
{
   ...


To find opacity you do

var x = $('#test').css('opacity');
x==0 ? alert('opacity is 0') : alert('Opacity is not 0');

Check working example at http://jsfiddle.net/SCHNc/1/


jquery.support.opacity

on jQuery 1.7.1 seems to work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜