开发者

Jquery setting opacity issue

$("html").fadeTo("slow",0.5); 
OR 
$("html").css({ 'opacity':'0.5' });

Why does either of these scripts whiten the page? I need it to become darker, no whiter, and usually that's what opacity doe开发者_Python百科s but not here...

How can I set a black opacity to my html with jquery?


Add a black div and fade it in on top of everything

HTML:

<body>
    <div id="cover"></div>
</body>

CSS:

#cover {
    height:100%;
    width:100%;
    background-color:#000;
    display:none;
    position:absolute;
    top:0;
    left:0;
    z-index:99999999;
}

JQuery:

$('#cover').fadeTo("slow",0.5);

Here's a working example: http://jsfiddle.net/AlienWebguy/GM2Z6/2/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜